在Android的画廊访问特定的文件夹

编程入门 行业动态 更新时间:2024-10-28 06:34:31
本文介绍了在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的画廊访问特定的文件夹

本文发布于:2023-10-31 16:50:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546693.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:画廊   文件夹   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!