意图和捆绑关系 [英] Intent and Bundle Relation

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

问题描述

在使用意图对象,我们可以把不同类型的数据直接使用其 putExtra()。我们也可以把这些额外的数据放入捆绑对象,并将其添加到意图。那么,为什么我们需要捆绑如果我们能做到这一点使用意图直接?

While using Intent object we can put different types of data directly using its putExtra(). We can also put these extra data into a Bundle object and add it to Intent. So why do we need Bundle if we can do so using Intent directly?

推荐答案

有时候,你需要传递仅几个变量一些其他活动,但如果你有一个一堆变量或值,你需要通过各种活动。在这种情况下,你可以使用捆绑并通过捆绑到所需的活动自如。相反,单变量的每一次传球。

Sometimes you need to pass only a few variables or values to some Other Activity, but what if you have a bunch of variable's or values that you need to pass to various Activities. In that case you can use Bundle and pass the Bundle to the required Activity with ease. Instead of passing single variable's every time.

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

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