Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.net.Uri; import android.os.Environment; import java.io.File; import java.io.FileOutputStream; public class Main { public static Uri saveBitmapToSDCard(Bitmap bitmap, String title) { File appDir = new File(Environment.getExternalStorageDirectory(), "Gank"); if (!appDir.exists()) { appDir.mkdirs(); } String fileName = title.replace("/", "-") + "-girl.jpg"; File file = new File(appDir, fileName); FileOutputStream outputStream; try { outputStream = new FileOutputStream(file); assert bitmap != null; bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream); outputStream.flush(); outputStream.close(); } catch (Exception e) { e.printStackTrace(); return null; } return Uri.fromFile(file); } }