Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.ContextWrapper; import android.graphics.Bitmap; import java.io.File; import java.io.FileOutputStream; public class Main { public static String saveToInternalStorage(Context context, Bitmap bitmapImage) { ContextWrapper cw = new ContextWrapper(context); // path to /data/data/yourapp/app_data/imageDir File directory = cw.getDir("imageDir", Context.MODE_PRIVATE); // Create imageDir File mypath = new File(directory, "gravatar.jpg"); FileOutputStream fos = null; try { fos = new FileOutputStream(mypath); // Use the compress method on the BitMap object to write image to the OutputStream bitmapImage.compress(Bitmap.CompressFormat.PNG, 100, fos); fos.close(); } catch (Exception e) { e.printStackTrace(); } return directory.getAbsolutePath(); } }