我想从存储中仅选择pdf,xlsx和txt文件,但intent.setType只能执行一个文件(仅限eg.txt文件(或)pdf文件).是否可以通过编码intent.setType()来获取所有三个文件,并且有办法吗?
这是我的一些代码.
private void showFileChooser() {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("application/pdf");
intent.addCategory(Intent.CATEGORY_OPENABLE);
try {
startActivityForResult(
Intent.createChooser(intent, "Select txt file"),
0);
} catch (android.content.ActivityNotFoundException ex) {
// Potentially direct the user to the Market with a Dialog
}
}
Run Code Online (Sandbox Code Playgroud) 我在girdview中使用通用图像加载器.有些视频可以改变图像,有些不起作用并且给出错误,
03-17 12:49:52.287: D/skia(21755): --- SkImageDecoder::Factory returned null
03-17 12:49:52.287: E/ImageLoader(21755): Image can't be decoded [file:////storage/sdcard0/Movies/Naruto Episodes 55.mp4_270x270]
Run Code Online (Sandbox Code Playgroud)
这是我在主类中的代码.
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheOnDisc(true).cacheInMemory(true)
.imageScaleType(ImageScaleType.EXACTLY)
.displayer(new FadeInBitmapDisplayer(300)).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
getApplicationContext())
.defaultDisplayImageOptions(defaultOptions)
.memoryCache(new WeakMemoryCache())
.discCacheSize(100 * 1024 * 1024).build();
ImageLoader.getInstance().init(config);
Run Code Online (Sandbox Code Playgroud)
这是adpater中的代码,
String url = "/storage/sdcard0/Movies/Naruto Episodes 55.mp4";
ImageLoader imageLoader = ImageLoader.getInstance();
DisplayImageOptions options = new DisplayImageOptions.Builder().cacheInMemory(true)
.cacheOnDisc(true).resetViewBeforeLoading(true)
.showImageForEmptyUri(R.drawable.x_document_icon)
.showImageOnFail(R.drawable.x_document_icon)
.showImageOnLoading(R.drawable.x_document_icon).build();
//initialize image view
//download and display image from url
imageLoader.displayImage("file:///"+url, img_btn, options);
Run Code Online (Sandbox Code Playgroud)
以下代码工作正常但需要一些时间.
Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(url, …Run Code Online (Sandbox Code Playgroud)