android – 如何从模拟器的SD卡中获取所有图片并将其显示在listView中?

android – 如何从模拟器的SD卡中获取所有图片并将其显示在listView中?,第1张

概述我的模拟器的SD卡中有一个名为images的文件夹.此文件夹包含从我的应用程序中单击的图片.我想将该文件夹中的所有图片显示到列表视图中.我怎样才能做到这一点?提前致谢. 这应该让你开始. http://android-er.blogspot.com/2010/01/android-file-explorer-with-jpgs-exif_08.html 计算要求的简单逻辑, private voi 我的模拟器的SD卡中有一个名为images的文件夹.此文件夹包含从我的应用程序中单击的图片.我想将该文件夹中的所有图片显示到列表视图中.我怎样才能做到这一点?提前致谢.解决方法 这应该让你开始.

http://android-er.blogspot.com/2010/01/android-file-explorer-with-jpgs-exif_08.html

计算要求的简单逻辑,

private voID getDir(String dirPath){myPath.setText("Location: " + dirPath);item = new ArrayList<String>();path = new ArrayList<String>();file f = new file(dirPath);file[] files = f.Listfiles();if(!dirPath.equals(root)){ item.add(root); path.add(root); item.add("../"); path.add(f.getParent());}for(int i=0; i < files.length; i++){  file file = files[i];  path.add(file.getPath());  if(file.isDirectory())   item.add(file.getname() + "/");  else   item.add(file.getname());}ArrayAdapter<String> fileList = new ArrayAdapter<String>(this,R.layout.row,item);setlistadapter(fileList); }
总结

以上是内存溢出为你收集整理的android – 如何从模拟器的SD卡中获取所有图片并将其显示在listView中?全部内容,希望文章能够帮你解决android – 如何从模拟器的SD卡中获取所有图片并将其显示在listView中?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1123054.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存