android开发如何用file读出sdcard中含图片的文件夹,并将文件夹显示到listview上???? fileandroidlistview 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这是我的思路: 标准的文件遍历。 在遍历过程中定义String或者File parentPath记录当前目录的父目录,然后在当前目录的遍历中检测是否包含图片,一扫描到有图片文件就将parentPath加入到List中。如果你只需要所有包含图片的文件目录的话这样就行。 如果你还想做成点击listview来层层进入的话那就维护一颗树吧。 发我一份吧,谢谢 [email protected] 求一份源码[email protected] 万分感激 [email protected] 求源码 谢谢了,这个东西我弄了1个多月了,还是真不明白,网上说的都太不靠谱了! 麻烦发我一份源码吧!android开发如何用file读出sdcard中含图片的文件夹,并将文件夹显示到listview上???? [email protected]可以发代码给我吗? [email protected] 我也想参考一下 求个源码啊,谢谢了,[email protected] [email protected] , 急求份源码,楼主谢了~~~~~ [email protected]同求一份啊,楼主分享 /** * 从SDcard 下扫描所有图片,获取图片list * * @param file */ private void getPicList(File file) { if (!file.exists()) return; File[] files = file.listFiles(); if (files == null || files.length == 0) return; for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { getPicList(files[i]); } else if (files[i].isFile()) { String filename = files[i].getName(); if (isPic(filename)) { String path = files[i].getAbsolutePath(); if (path.contains(photoPath)) { PicInfo pic = new PicInfo(); Log.d(TAG, "path is " + path); pic.path = path; cameraList.add(pic); } } } } } 楼主,求代码 ,求分享 [email protected] [email protected]我也遇到了,求份源码 [email protected] 求份源码 感激不尽 [email protected] 楼主 急需啊 发个代码给我吧 感激不尽 麻烦lz发我一份参考一下吧!多谢!邮箱是:[email protected] 给我一份可以吗?邮箱[email protected] [email protected] 求大神源码 楼柱,求一份源码!邮箱:[email protected] 3Q 楼主,我也要一份 [email protected] ,谢谢哈 [email protected] 楼主好人求源码! [email protected] 感谢楼主能够分享,楼主好人 android截屏,难题,真的很难! 求解X的Y次方,X和Y都是浮点数 怎么做? android:如何用Ksoap2来把数组或列表作为参数传给一个webservice android弹出对话框 android 有用过万普世纪这个广告平台的进来聊聊 急,xt910无法进行真机调试 IO流读取数据库文件出错,急求! 验证 Android Pad 是否真正进入了suspend android+html 滚动条不显示 小弟求教大家安卓错误 @android:id/list 和@+id/android:list的区别。 如何让图片先淡化显示后淡化消失
标准的文件遍历。
在遍历过程中定义String或者File parentPath记录当前目录的父目录,然后在当前目录的遍历中检测是否包含图片,一扫描到有图片文件就将parentPath加入到List中。如果你只需要所有包含图片的文件目录的话这样就行。
如果你还想做成点击listview来层层进入的话那就维护一颗树吧。
可以发代码给我吗?
* 从SDcard 下扫描所有图片,获取图片list
*
* @param file
*/
private void getPicList(File file) {
if (!file.exists())
return;
File[] files = file.listFiles();
if (files == null || files.length == 0)
return;
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
getPicList(files[i]);
} else if (files[i].isFile()) {
String filename = files[i].getName();
if (isPic(filename)) {
String path = files[i].getAbsolutePath();
if (path.contains(photoPath)) {
PicInfo pic = new PicInfo();
Log.d(TAG, "path is " + path);
pic.path = path;
cameraList.add(pic);
}
}
}
}
}