I tried to use the following code to rescan some files, but
onMediaScannerConnected() is never called. I followed the debugger and
saw the last call (mConnection.connect()) is called, but nothing
happened after that. Did I do something wrong? Any ideas? BTW, I run
the text on a emulator, not the real phone.
Thanks.
private class MediaScannerNotifier implements
MediaScannerConnectionClient {
private Context mContext;
private MediaScannerConnection mConnection;
private String mPath;
private String mMimeType;
public MediaScannerNotifier(Context context, String path, String
mimeType) {
mContext = context;
mPath = path;
mMimeType = mimeType;
mConnection = new MediaScannerConnection(mContext, this);
mConnection.connect();
}
public void onMediaScannerConnected() {
mConnection.scanFile(mPath, mMimeType);
}
public void onScanCompleted(String path, final Uri uri) {
try {
mMsgHandler.post(new Runnable() {
public void run() {
}});
} finally {
mConnection.disconnect();
mContext = null;
}
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---