I am trying to use MediaScannerConnection to update content provider
of a newly downloaded MP3. However no matter what I do it does not
seem to be able to connect. I have even put this chunk of code into
onCreate and hardcoded to path of an existing file but still no dice.
MediaScannerConnection scanner = new
MediaScannerConnection(this,
null);
scanner.connect();
while(!scanner.isConnected()){
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
scanner.scanFile("/sdcard/path/file.mp3", "audio/*");
scanner.disconnect();
It never exits the loop. If i do not put the loop in, it just force
closes and complains that it is not yet connected. Any ideas?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---