Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.Intent; import android.net.Uri; import java.io.File; public class Main { /** * Add file photo to gallery after capture from camera or downloaded. * * @param context * @param file */ public static void galleryAddPic(Context context, File file) { Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri contentUri = Uri.fromFile(file); mediaScanIntent.setData(contentUri); context.sendBroadcast(mediaScanIntent); } }