use*_*321 42 android bundle android-intent
我有一点时间通过Intent/ Bundles 搞清楚我的方法会有什么数据.我已经尝试添加断点来检查数据,但我没有看到任何东西.也许是因为Parcelable我无法在Eclipse中手动读取它.
例如,a onActivityResult(int requestCode, int resultCode, Intent data)表示a Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI).我如何知道可用的数据?请注意,我不是要求提供哪些数据,但我是如何理解的,所以我可以将相同的想法应用于任何Bundle/ Intent来自Android框架?也许这看起来像文档一样简单,但我没有看到完整的数据列表,我在Eclipse中看不到它.所以我迷路了.
184*_*615 47
public static String bundle2string(Bundle bundle) {
if (bundle == null) {
return null;
}
String string = "Bundle{";
for (String key : bundle.keySet()) {
string += " " + key + " => " + bundle.get(key) + ";";
}
string += " }Bundle";
return string;
}
Run Code Online (Sandbox Code Playgroud)
我得到了存储包的所有键和值...
for (String key : bundle.keySet()) {
string += " " + key + " => " + bundle.get(key) + ";";
}
Run Code Online (Sandbox Code Playgroud)
输出:
(key) :(value)
profile_name:abc
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
31831 次 |
| 最近记录: |