Java tutorial
//package com.java2s; import android.content.Context; import android.graphics.Bitmap; import android.net.Uri; import android.provider.MediaStore; public class Main { public static Uri bitmap2Uri(final Context context, final Bitmap bitmap) { return context == null || bitmap == null ? null : Uri.parse(MediaStore.Images.Media.insertImage(context.getContentResolver(), bitmap, null, null)); } }