Back to project page GuiLib.
The source code is released under:
Apache License
If you think the Android project GuiLib listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.gandulf.guilib.download; /* www .j ava2 s . co m*/ import android.content.Context; import android.media.MediaScannerConnection; import android.net.Uri; /** * @author Ganymede * */ public class MediaScannerWrapper implements MediaScannerConnection.MediaScannerConnectionClient { private MediaScannerConnection mConnection; private String mPath; private String mMimeType; // filePath - where to scan; // mime type of media to scan i.e. "image/jpeg". // use "*/*" for any media public MediaScannerWrapper(Context ctx, String filePath, String mime) { mPath = filePath; mMimeType = mime; mConnection = new MediaScannerConnection(ctx, this); } // do the scanning public void scan() { mConnection.connect(); } // start the scan when scanner is ready public void onMediaScannerConnected() { mConnection.scanFile(mPath, mMimeType); } public void onScanCompleted(String path, Uri uri) { mConnection.disconnect(); } }