Intent类里头的参数解释以及相关处理

一、图片剪辑用到的参数以及方法

图片剪辑肯定是要跳转到剪辑页面啦各位兄弟。下面这一句就是跳转

Intent intent = new Intent("com.android.camera.action.CROP");

单从字面意思上可以看出来

Intent.FLAG_GRANT_READ_URI_PERMISSION//第一个是读取的权限

进入源码看下怎么解释

/**
 * If set, the recipient of this Intent will be granted permission to
 * perform read operations on the URI in the Intent's data and any URIs
 * specified in its ClipData.  When applying to an Intent's ClipData,
 * all URIs as well as recursive traversals through data or other ClipData
 * in Intent items will be granted; only the grant flags of the top-level
 * Intent are used.
 */
也就是说这个会被授予权限,然后对图片进行剪辑,以及对uris中的各个uri递归遍历进行编辑


Intent.FLAG_GRANT_WRITE_URI_PERMISSION//这个是写入的权限

读 写操作同理


intent.addFlags()//这个是一个增加标志的方法 也就是可以指定跳转并执行操作
intent.setDataAndType(uri, "image/*");//设置数据和类型,跳转后需要操作的数据以及类型
//这里的意思,处理uri的数据,他的类型是图片类型

后续更新



猜你喜欢

转载自blog.csdn.net/qq_36099573/article/details/79937034