内置的画廊Android开放的文件夹图片 [英] Android open folder image with built-in gallery

查看:244
本文介绍了内置的画廊Android开放的文件夹图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打开一个图像与android文件夹,内置画廊。
例如,我有一个包含图像,我想与画廊打开一个文件夹路径。
我用这code,它会打开一个包含任何图像画廊。
任何想法?

 意向意图=新的Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(新文件(folderImages)),图像/ *);
    startActivityForResult(意向,1);


解决方案

也许试试这个:

 意向意图=新的Intent();
intent.setType(图像/ *);
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(意图,),1)

I want to open a images folder with android built-in gallery. For example, I have a folder path that contains images, i want to open it with gallery. I am using this code, it opens the gallery that contains no images. Any idea?

    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new  File(folderImages)),"image/*");
    startActivityForResult(intent, 1);

解决方案

Maybe try this one:

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, ""), 1)

这篇关于内置的画廊Android开放的文件夹图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆