在Android中访问相册特定文件夹

3
我希望打开相册中的特定文件夹。我知道如何打开相册并选择其中任意一张图片。但我只想在默认相册中打开文件夹。 另有一种方式可以通过在活动中创建画廊来手动访问这些图片。但我想要在默认相册中打开它。 我尝试了这个方法,但显然不起作用。
                Intent intent = new Intent();
                intent.setType("image/myFolder/*");
                intent.setAction(Intent.ACTION_VIEW);
                startActivity(Intent.createChooser(intent,
                        "Select Picture"));

有人可以帮忙吗?

提前感谢。


尝试这个:https://dev59.com/X3I-5IYBdhLWcg3wqqTg#1895449 - Nguyen Minh Binh
1个回答

0

我认为这可能会帮助某些人... 因为我已经找到了解决我的问题的方法。

      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 文件夹下的所有文件。

干杯!!


@alex:它不会打开相册,它只是用于获取特定文件夹中的图像文件在编码中。 - djk
4
这并没有回答原来的问题! - j.c

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接