• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps HELP: Saving Bitmap Image to device

Hello everyone, I have a basic application that uses just squares and circles that appear when the screen is toched. I want to be able to save this created image, the design is build on a bitmap image, and displayed on the canvas so I want to be able to save that as an image to the mobile device.

Any ideas on the code for saving this? I can post the source code if needed, also I can send via email if anyone could help me it would be most appreciated.

Thanks for your time.
 
You can save a Bitmap object as a PNG like this:
Code:
FileOutputStream outputStream = mContext.openFileOutput("picture.png", Context.MODE_PRIVATE);
bmp.compress(Bitmap.CompressFormat.PNG, 95, outputStream);

Where "bmp" is your Bitmap object and mContext is a valid Context (like your activity). The number 95 is the compression quality. The image will be stored in your applications private data (you might need additional permissions to put it elsewhere).
 
Back
Top Bottom