清单的意图的所有演员 [英] Listing all extras of an Intent

查看:106
本文介绍了清单的意图的所有演员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关调试的原因,我想列出一个Intent的所有演员(和它们的值)。现在,让键是没有问题

For debugging reasons I want to list all extras (and their values) of an Intent. Now, getting the keys isn't a problem

Set<String> keys = intent.getExtras().keySet();

但得到的键的值是1,对我来说,因为一些值是字符串,有些是布尔......我怎么能得到价值在一个循环(通过按键循环)和值写入日志文件?感谢您的任何提示!

but getting the values of the keys is one for me, because some values are strings, some are boolean... How could I get the values in a loop (looping through the keys) and write the values to a logfile? Thanks for any hint!

推荐答案

下面是我用来获取对一个未公开的(第三方)的信息意图:

Here's what I used to get information on an undocumented (3rd-party) intent:

for (String key : bundle.keySet()) {
    Object value = bundle.get(key);
    Log.d(TAG, String.format("%s %s (%s)", key,  
        value.toString(), value.getClass().getName()));
}

(请务必检查是空循环之前)

这篇关于清单的意图的所有演员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆