Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.Intent; import android.net.Uri; import java.io.File; public class Main { public static void addNewImageToGallery(Context context, String filePath) { Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); File f = new File(filePath); Uri contentUri = Uri.fromFile(f); mediaScanIntent.setData(contentUri); context.sendBroadcast(mediaScanIntent); } }