Today I received yet another instance of this crash problem, again on
a Droid with Android 2.01:

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

Is this a Droid bug, or am I missing something? My code is nothing
special, and is just meant to update the image Gallery after writing a
JPEG file. Must one add a supplementary MediaScannerService check, and
if so, how?

Thanks

On Dec 14, 4:11 pm, blindfold <[email protected]> wrote:
> After http://groups.google.com/group/android-developers/browse_frm/thread/1...
> 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 toMediaScannerService
> 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 associatedMediaScannerService?
>
> 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