android获取手机所有图片
来源:互联网 发布:简易流程图制作软件 编辑:程序博客网 时间:2024/05/01 22:28
public ImageFilesBean returnImageFiles() { List<String> parentsPthe = new ArrayList<>(); HashMap<String, String> pathMap = new HashMap<>(); Cursor cursor = getContentResolver().query( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, null, null, null); while (cursor.moveToNext()) { //获取其他图片信息// String fileName = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME)); String filePath = cursor.getString(cursor .getColumnIndex(MediaStore.Images.Media.DATA)); String parentName = new File(filePath).getParentFile().getAbsolutePath(); if (!parentsPthe.contains(parentName)) { parentsPthe.add(parentName); pathMap.put(parentName, filePath); } } cursor.close(); return ImageFilesBean.returnBean(parentsPthe, pathMap); }package beini.com.ddd;import java.util.ArrayList;import java.util.HashMap;import java.util.List;public class ImageFilesBean { private List<String> parentsPthe = new ArrayList<>(); private HashMap<String, String> pathMap = new HashMap<>(); public List<String> getParentsPthe() { return parentsPthe; } public ImageFilesBean setParentsPthe(List<String> parentsPthe) { this.parentsPthe = parentsPthe; return this; } public HashMap<String, String> getPathMap() { return pathMap; } public ImageFilesBean setPathMap(HashMap<String, String> pathMap) { this.pathMap = pathMap; return this; } public static ImageFilesBean returnBean(List<String> parentsPthe, HashMap<String, String> pathMap) { return new ImageFilesBean().setParentsPthe(parentsPthe).setPathMap(pathMap); }}
阅读全文
1 0
- android获取手机所有图片
- Android 获取手机中所有图片
- android 获取手机内所有图片
- Android-获取手机上所有图片
- 获取手机所有图片
- Android实现获取手机里面的所有图片
- Android实现获取手机里面的所有图片
- Android获取手机内的所有图片和视频
- Android 获取手机图片
- ios 获取手机中所有图片
- 获取手机所有图片并显示
- 安卓获取手机所有图片
- iOS - 获取手机中所有图片
- android 获取手机中的所有图片或某一目录下的图片
- 获取Android手机中所有的短信
- 获取Android手机中所有的短信
- android 获取手机所有短信内容
- 获取Android手机中所有的短信
- JavaScript基础(12.面向对象及原型简介)
- 为什么要前后端分离
- 分布式事务型关系数据库 AntDB
- angluar2 学习(二)
- Linux CPU实时监控mpstat命令详解
- android获取手机所有图片
- Python 之 使用 PIL 库做图像处理
- Paython简史
- 数据结构第十一周项目(四)——利用遍历思想求解图问题
- [媒体]PCIe NVMe SSD准备“蚕食”企业级存储系统了
- opcache的使用
- maven使用mybatis-generator自动生成代码
- Day22—设计模式、查找算法、排序算法
- 每天学一点python----逻辑行、物理行、换行