关于android 5.0调用系统相册闪退
来源:互联网 发布:mysql 清空数据库表 编辑:程序博客网 时间:2024/05/01 13:56
最近做的一个项目中需要调用本地相册,本以为是一个很简单的要求。但是当我在android5.0上运行的时候打开相册,APP闪退。
Android调用本地相册,Intent.ACTION_GET_CONTENT和 Intent.ACTION_PICK都是打开本地相册的两种意图活动。这两种方法在android5.0以前使用后得到的结果都一样。但是在android5.0之后,这两种打开本地相册的方式有了明显的区别。
用Intent.ACTION_GET_CONTENT打开android5.0的相册时,显示的是文件的形式,点击一个文件夹之后并没有打开显示图片,而是提示APP闪退。而用 Intent.ACTION_PICK,打开android5.0的本地相册显示的是每一张图片可以随时返回图片的URL。
public static final String ACTION_PICK
Activity Action: Pick an item from the data, returning what was selected.
Input: getData()
is URI containing a directory of data (vnd.android.cursor.dir/*) from which to pick an item.
Output: The URI of the item that was picked.
public static final String ACTION_GET_CONTENT
Activity Action: Allow the user to select a particular kind of data and return it. This is different thanACTION_PICK
in that here we just say what kind of data is desired, not a URI of existing data from which the user can pick. An ACTION_GET_CONTENT could allow the user to create the data as it runs (for example taking a picture or recording a sound), let them browse over the web and download the desired data, etc.
API中也解释道和ACTION_PICK的不同,返回的是什么样的数据,不是用户想要选着的具体URl.
虽然API有所解释但在android5.0以前这两个活动的结果是一样的,android5.0后才具体的体现了这两种的区别。所以建议各位如果在有打开本地相册选取图片的时候选着ACTION_PICK活动。
有知道这两种ACTION在android5.0才存在区别的,请留言告知。
以上仅是个人观点,有不对的地方情留言改正。
- 关于android 5.0调用系统相册闪退
- 关于android 5.0调用系统相册闪退
- android 调用小米相册,相机闪退 销毁当前activity
- 调用系统相册 Android
- android调用系统相册
- Android 调用系统 相册代码
- Unity3D调用Android系统相册
- android怎样调用系统相册
- android 调用系统图库剪切图片出现黑屏闪退
- iPad横屏调用相册,出现闪退
- iOS10调用相册导致模拟器和xcode闪退
- Android——调用系统相册
- 调用Android系统相册并裁剪图片
- Android 调用系统相册(带裁剪)
- Android 调用系统相机以及相册源码
- Android 调用系统相机以及相册源码
- android 调用系统相机和相册
- 在WebView中调用android系统相册
- 浅谈Android自定义View
- bash 算术运算符优先级
- java static的作用详解(转)
- Bresenham 算法——matlab实现
- 自定义CheckBox,用自己的方式来实现个性勾选。checkbox与button的联动。
- 关于android 5.0调用系统相册闪退
- 十年微博测试
- Crazy Thairs_poj3378_DP+离散+高精度+树状数组
- exit()函数
- Jack学JAVA第一周:浅谈div+css快速布局;java:一张图让你知道数据类型的关系
- X64操作系统组件Jmail无法正常服务问题
- Java IO - InputStreamReader&OutputStreamWriter
- NYOJ - 35 表达式求值
- JDK 动态代理实现原理