Android——调用系统相册
16lz
2021-01-23
一、调用系统相册App,浏览所用图片
Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setType("image/*"); startActivity(intent);
二、调用系统相册,并从中选择一张照片
Intent intent = new Intent(); intent.setAction(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); startActivityForResult(Intent.createChooser(intent, "Select Picture"),1);
三、调用系统相册查看单张(或特定)图片(此处系转载:http://java-android.blogbus.com/logs/151611473.html)
//下方是将ImageList集合中的图片路径转换为可供File识别的String数据, String value = String.valueOf(mImagesList.get(pos).getPicturePath()); File file = new File(value); //下方是是通过Intent调用系统的图片查看器的关键代码 Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "image/*"); startActivity(intent);
更多相关文章
- Android 图片处理工具类封装
- android 获取本应用详细系统参数
- android 下载图片保存在sdcard并显示可拖动缩放
- android 向系统通讯录添加一个联系人信息
- 一个好用的android图片压缩工具类
- android保存Bitmap图片到指定文件夹示例
- Android 系统源码分析之View(一)
- Android 获取手机相册照片,返回并展示
- Android修改语言设置--项目需求需要修改在应用中修改系统时间