I'm using the MediaScannerConnection example code from the API Demos
The snippet I'm using is:
MediaScannerConnection.scanFile(
context,
new String[] { permFile.getAbsolutePath() },
null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(String path, Uri uri) {
android.util.Log.i("ExternalStorage", "Scanned " + path + ":");
android.util.Log.i("ExternalStorage", "-> uri=" + uri);
}
});
When I run this code, I get an FC dialog with the following from the LogCat:
4-20 23:17:45.988: ERROR/ActivityThread(3015): Activity com.my.package.name has leaked ServiceConnection android.media.MediaScannerConnection@40715c70 that was originally bound here
04-20 23:17:45.988: ERROR/ActivityThread(3015): android.app.ServiceConnectionLeaked: Activity com.my.package.name has leaked ServiceConnection android.media.MediaScannerConnection@40715c70 that was originally bound here
What am I doing wrong?
FYI, I'm running this from a background thread using AsyncTask.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…