在Android的画廊访问特定的文件夹 [英] Access Specific folder of gallery in Android

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

问题描述

我想开画廊的特定文件夹。我知道code开画廊,并选择从任何图像。但我想在默认画廊刚刚打开的文件夹。
还有另一种方式来手动访问图像,并通过活动vreating画廊表现出来。但我想在默认情况下打开。

I want to open specific folder of gallery. I know the code to open gallery and choose any image from that. But i want to just open folder in a default gallery. There is another way to manually access that images and show it by vreating gallery in activity. But i want to open in default.

我想这一个。但显然没有工作。

i tried this one. But obviously not working.

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

任何人都可以帮忙吗?

Anyone can help?

在此先感谢

推荐答案

我想这可能帮助别人...
正如我已经找到解决我的问题。

I think it may help somebody... As i have found solution to my problem.

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

m_list contains all the files under folder_name.

干杯!!

这篇关于在Android的画廊访问特定的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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