After 
http://groups.google.com/group/android-developers/browse_frm/thread/1369e4a1dc495cd7/
I am using

mScanner = new MediaScannerConnection(this,
   new MediaScannerConnection.MediaScannerConnectionClient() {
      public void onMediaScannerConnected() {
         mScanner.scanFile(fileName, null /* mimeType */);
      }
      public void onScanCompleted(String path, Uri uri) {
         if (path.equals(fileName.toString())) {
         mScanner.disconnect();
      }
   }
});
mScanner.connect();

This works fine on my ADP1, but on Motorola Droid with Android 2.01
this (occasionally?) results in crashes with

java.lang.IllegalStateException: not connected to MediaScannerService
at android.media.MediaScannerConnection.scanFile
(MediaScannerConnection.java:148) at
blah.blah.blah.onMediaScannerConnected(Unknown Source)

while scanFile() is called inside onMediaScannerConnected(). Why would
there be a MediaScannerConnection without an associated
MediaScannerService?

Thanks!

-- 
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

Reply via email to