Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.media.MediaScannerConnection; import android.net.Uri; import android.os.AsyncTask; import android.util.Log; import java.io.File; public class Main { public static void mediaScannerCall(final Context context, final File file) { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... params) { MediaScannerConnection.scanFile(context, new String[] { file.toString() }, null, new MediaScannerConnection.OnScanCompletedListener() { public void onScanCompleted(String path, Uri uri) { Log.i("ExternalStorage", "Scanned " + path + ":"); Log.i("ExternalStorage", "-> uri=" + uri); } }); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, null, null, null); } }