android - 在Android中访问图库的特定文件夹

标签 android gallery

我想打开画廊的特定文件夹。我知道打开图库并从中选择任何图像的代码。但我只想在默认图库中打开文件夹。 还有另一种方法可以手动访问该图像并通过 Activity 中的 vreat gallery 显示它。但我想默认打开。

我试过这个。但显然不起作用。

                Intent intent = new Intent();
                intent.setType("image/myFolder/*");
                intent.setAction(Intent.ACTION_VIEW);
                startActivity(Intent.createChooser(intent,
                        "Select Picture"));

有人可以帮忙吗?

提前致谢

最佳答案

我认为这可能对某些人有帮助... 因为我找到了解决问题的办法。

      private ArrayList<File> m_list = new ArrayList<File>();

      String folderpath = Environment.getExternalStorageDirectory()
            + File.separator + "folder_name/";
         File dir = new File(folderpath);
         m_list.clear();
            if (dir.isDirectory()) {
                File[] files = dir.listFiles();
                for (File file : files) {
                    if (!file.getPath().contains("Not_Found"))
                        m_list.add(file);
                }
             }

m_list 包含 folder_name 下的所有文件。

干杯!

关于android - 在Android中访问图库的特定文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6519024/

相关文章:

java - 打开短信并在其中放置一个随机数组

android - 可以部署两个不同的 Android 应用程序作为已在两个国家/地区部署的应用程序的升级吗?

android - 这是从一组图像中找到与 "input"图像相似的图像的最佳算法

html - 想要在我的画廊中并排放置图片 (Html)

jquery - 增加 Photoswipe Gallery 的缩放比例

android如何创建多行 ListView

android - Android 增强型电子商务分析页面上缺少数据

javascript - Swiper spaceBetween 无法正常工作

javascript - 如何将 jQuery 变量用于此图片库叠加层?

html - Twitter Bootstrap 图片库未显示标题