本文整理汇总了Java中android.media.MediaScannerConnection.OnScanCompletedListener类的典型用法代码示例。如果您正苦于以下问题:Java OnScanCompletedListener类的具体用法?Java OnScanCompletedListener怎么用?Java OnScanCompletedListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OnScanCompletedListener类属于android.media.MediaScannerConnection包,在下文中一共展示了OnScanCompletedListener类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onRefresh
import android.media.MediaScannerConnection.OnScanCompletedListener; //导入依赖的package包/类
@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);
}
}
}
开发者ID:rafali,项目名称:flickr-uploader,代码行数:31,代码来源:FlickrUploaderActivity.java
示例2: scanMediaFiles
import android.media.MediaScannerConnection.OnScanCompletedListener; //导入依赖的package包/类
/**
* @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
}
});
}
开发者ID:RincLiu,项目名称:Roid-Library,代码行数:14,代码来源:RLSysUtil.java
示例3: scanMedia
import android.media.MediaScannerConnection.OnScanCompletedListener; //导入依赖的package包/类
public static void scanMedia(Context context, final String[] filePath, final String[] mime) {
MediaScannerConnection.scanFile(context, filePath, mime, new OnScanCompletedListener() {
@Override
public void onScanCompleted(String path, Uri uri) {
Log.v(DEBUG_TAG, "file " + path + " was scanned seccessfully: " + uri);
}
});
}
开发者ID:thatapps,项目名称:goloader,代码行数:9,代码来源:Utils.java
示例4: scanMediaJpegFile
import android.media.MediaScannerConnection.OnScanCompletedListener; //导入依赖的package包/类
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);
}
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:7,代码来源:Utils.java
注:本文中的android.media.MediaScannerConnection.OnScanCompletedListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论