Copy image to internal memory

android

Solution

You can use the following combination of openFileOutput() and Bitmap.compress() to store the image to the internal storage.

// Create a BitMap object of the image to be worked with
final Bitmap bm = BitmapFactory.decodeStream( ..some image.. );

// The openfileOutput() method creates a file on the phone/internal storage in the context of your application 
final FileOutputStream fos = openFileOutput("my_new_image.jpg", Context.MODE_PRIVATE);

// Use the compress method on the BitMap object to write image to the OutputStream
bm.compress(CompressFormat.JPEG, 90, fos);

Problem

How I copy a image to internal memory and recover after that?

Original source