I'm not sure about the process of removing a file from the database. I
suggest looking at the Music Player source - it has an option to
delete files from the SD card.

Under what circumstances would files be deleted without mounting and
re-mounting the SD card? That sounds like a poorly behaved app.

On Feb 17, 6:03 pm, "info.sktechnol...@gmail.com"
<info.sktechnol...@gmail.com> wrote:
> Thanks, this solves my first problem.
> Now what if media files are deleted?
> What if I do not know which ones have been deleted?
> Is there a way to have it rescan the entire SD card in the
> way it must do if the card has been removed and reinserted?
>
> On Feb 14, 2:01 pm, Dave Sparks <davidspa...@android.com> wrote:
>
> > You want something like this in your activity:
>
> > import android.media.MediaScannerConnection;
> > import
> > android.media.MediaScannerConnection.MediaScannerConnectionClient;
>
> > private static 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(context, this);
> >         mConnection.connect();
> >     }
>
> >     public void onMediaScannerConnected() {
> >         mConnection.scanFile(mPath, mMimeType);
> >     }
>
> >     public void onScanCompleted(String path, Uri uri) {
> >         // OPTIONAL: scan is complete, this will cause the viewer to
> > render it
> >         try {
> >             if (uri != null) {
> >                 Intent intent = new Intent(Intent.ACTION_VIEW);
> >                 intent.setData(uri);
> >                 mContext.startActivity(intent);
> >             }
> >         } finally {
> >             mConnection.disconnect();
> >             mContext = null;
> >         }
> >     }
>
> > }
>
> > To scan a file, you just create a new MediaScannerNotifier:
>
> > new MediaScannerNotifier(path, mimeType);
>
> > On Feb 14, 9:45 am, kolby <kolbys...@gmail.com> wrote:
>
> > > You can make an android.media.MediaScannerConnection, connect to it,
> > > and provide a client to scan a directory.
>
> > > Michael
>
> > > On Feb 14, 7:05 am, "info.sktechnol...@gmail.com"
>
> > > <info.sktechnol...@gmail.com> wrote:
> > > > If I progammatically store new media files on the SD card, the
> > > > MediaStore does not know about them until I remove and reinsert the SD
> > > > card.  Is there a way to tell the MediaStore to rescan the SD card
> > > > without first unmounting the SD card?- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to