我正在使用来自API Demos的MediaScannerConnection示例代码。
我使用的片段如下:
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);
}
});
当我运行这段代码时,我从LogCat中得到一个FC对话框,其内容如下: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
我哪里做错了?
顺便提一下,我是在使用AsyncTask的后台线程上运行这个程序的。