android.media.MediaScannerConnection.OnScanCompletedListener Java Examples
The following examples show how to use
android.media.MediaScannerConnection.OnScanCompletedListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RLSysUtil.java From Roid-Library with Apache License 2.0 | 5 votes |
/** * @param context * @param files * @param mimeTypes */ public static void scanMediaFiles(final Context context, String[] files, String[] mimeTypes) { MediaScannerConnection.scanFile(context, files, mimeTypes, new OnScanCompletedListener() { @Override public void onScanCompleted(String arg0, Uri arg1) { // TODO } }); }
Example #2
Source File: FlickrUploaderActivity.java From flickr-uploader with GNU General Public License v2.0 | 5 votes |
@Override public void onRefresh() { if (medias != null) { String root = null; for (Media media : medias) { if (root == null) { root = media.getFolderPath(); } else if (!media.getFolderPath().startsWith(root)) { while (root.length() > 1 && !media.getFolderPath().startsWith(root)) { root = ToolString.getParentPath(root); } if (root.length() <= 1) { break; } } } if (root != null) { LOG.debug("rescanning " + root); MediaScannerConnection.scanFile(getApplicationContext(), new String[]{root}, null, new OnScanCompletedListener() { @Override public void onScanCompleted(String path, Uri uri) { LOG.debug("file " + path + " was scanned seccessfully: " + uri); load(true); } }); } else { load(true); } } }
Example #3
Source File: Utils.java From android-open-project-demo with Apache License 2.0 | 4 votes |
public static void scanMediaJpegFile(final Context context, final File file, final OnScanCompletedListener listener) { MediaScannerConnection .scanFile(context, new String[]{file.getAbsolutePath()}, new String[]{"image/jpg"}, listener); }