![]() I use this code to save any graphic drawed using canvas, like fingerpaint or similar, I hope can be useful for your case Return super.onOptionsItemSelected(item) įile root = Environment.getExternalStorageDirectory() įile(root.getAbsolutePath()+"/DCIM/Camera/img.jpg") įileOutputStream ostream = new FileOutputStream(file) īpress(CompressFormat.JPEG, 100, ostream) Public boolean onOptionsItemSelected(MenuItem item) MenuItem menu5 = menu.add(0, 4, Menu.NONE, "Save!") MenuItem menu4 = menu.add(0, 3, Menu.NONE, "Oval") MenuItem menu3 = menu.add(0, 2, Menu.NONE, "Rectangle") MenuItem menu2 = menu.add(0, 1, Menu.NONE, "Outline Shape") MenuItem menu1 = menu.add(0, 0, Menu.NONE, "Filled Shape") SetContentView boolean onCreateOptionsMenu(Menu menu) Public class MainActivity extends Activity void onCreate(Bundle savedInstanceState) This is the part of the code where the menu code is, I want to be able to pres the save button here and for the bitmap image to be saved to the phone, preferably a standard gallery folder. Public boolean onTouch (View v, MotionEvent event) package _file īitmap.Config conf = _8888 īmp = Bitmap.createBitmap (1100, 1800, conf) ![]() This part of the code is where the bitmap image is created, the bitmap sits on the canvas, form this point I want to be able to save the image that is created on the bitmap, I have a drop down menu in the MainActivity with a 'save' option.
0 Comments
Leave a Reply. |