java - 如何了解 Android Studio Bundle 中的“关键”是什么?
问题描述
我正在使用一个不是最新的库。( https://github.com/notsukamto/GFIPhotoPicker ) 它有一个 onActivityResult 函数来获取活动结果。它用这个函数返回一个意图
if (selection != null) {
intent.putExtra(EXTRA_SELECTION, new LinkedList<>(selection));
}
public static List<Uri> getSelection(Intent data) {
return data.getParcelableArrayListExtra(EXTRA_SELECTION);}
所以我的问题是这个 Parcelable 的关键是什么以及我如何正确地获得这个意图?(我试过“EXTRA_SELECTION”但不起作用)
Bundle[
{com.github.potatodealer.gfiphotopicker.activity.extra.SELECTION=
[file:///storage/emulated/0/DCIM/Camera/IMG_20190114_072919.jpg,
file:///storage/emulated/0/DCIM/Camera/IMG_20190114_072904.jpg,
file:///storage/emulated/0/DCIM/Camera/IMG_20190114_072848.jpg],
com.github.potatodealer.gfiphotopicker.activity.extra.FACEBOOK_SELECTION=[],
com.github.potatodealer.gfiphotopicker.activity.extra.INSTAGRAM_SELECTION=[]
}
]
解决方案
如果您在提供的 github 链接中访问此目录EXTRA_SELECTION
,则每个活动中都会有一个常量。
例如,如果我们单击FacebookPreviewActivity.java
,我们会看到:
private static final String EXTRA_SELECTION = FacebookPreviewActivity.class.getPackage().getName() + ".extra.SELECTION";
推荐阅读
- python - 如何在列表中的字符串之间添加数字?
- python - 在aarch64上安装Tensorflow:错误:找不到满足tensorflow要求的版本
- angular - 将角度 http 响应转换为类
- c++ - 为 STL 列表编写选择排序?
- sql - 非常大的CSV冻结Ubuntu的postgres副本问题
- javascript - 导航问题
- javascript - 如何获取请求firebase云功能
- python - 如何创建类图并编写定义类的伪代码?
- python - 带有以太网数据接收的 Kivy 图形
- docker - 如何使用 Artifactory OSS 设置私有 Docker 存储库?