Intent.putExtra(字符串,捆绑)VS Intent.putExtra(捆绑) [英] Intent.putExtra(String,Bundle) vs Intent.putExtra(Bundle)

查看:224
本文介绍了Intent.putExtra(字符串,捆绑)VS Intent.putExtra(捆绑)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这问题听起来很蠢,但我瓦纳知道什么时候我们把活动名称Intent.putExtra()?在一个案例中,我们把额外的只有包,并在其他情况下,我们都与类名传递给它。我有点糊涂了,我们应该使用 Intent.putExtra(字符串,捆绑)我们已经通过了活动名称意图构造函数或不?

This question may sound stupid but I wana know When do we put activity name in Intent.putExtra()? In one case we are putting extra only with bundle and in other case we are passing it with class name. I am a little confused should we use Intent.putExtra(String, Bundle) we already have passed the activity name in Intent constructor or not?

感谢您的帮助!

推荐答案

我想你的意思 putExtra(字符串,捆绑) VS putExtras(包)(是取值)。

I think you mean putExtra(String, Bundle) vs putExtras(Bundle) (with s).

第一个加束为您提供的关键字的值。该包是简单的一个对象的值。

The first adds the bundle as the value for the key you provide. The bundle is simple an object value.

第二添加从提供的束的意图所有键/值对。在这种情况下,包的内容将被添加到的意图,而不是束本身

The second adds all the key/value pairs from the provided bundle to the intent. In this case the content of the bundle will be added to the intent, not the bundle itself.

把它们作为地图接口:

Map.put(String key, Object value)

VS

Map.putAll(Map anotherMap)

这篇关于Intent.putExtra(字符串,捆绑)VS Intent.putExtra(捆绑)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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