简体   繁体   English

Intent类的putExtra()方法是否返回Intent对象的值?

[英]Does putExtra() method of class Intent return a value of Intent object?

I am a new newbie learning Android development following the tutorial on developer.android.com . 我是一个新的新手学习Android开发的教程以下developer.android.com The putExtra() method of class Intent returns a value of Intent object. Intent类的putExtra()方法返回Intent对象的值。 But the code of the tutorial is intent.putExtra(EXTRA_MESSAGE, message); 但是本教程的代码是intent.putExtra(EXTRA_MESSAGE, message); . If so, the method can not return a value. 如果是这样,则该方法无法返回值。 Can you tell me why? 你能告诉我为什么吗? Thank you very much. 非常感谢你。

The put extra data can be accessed in the following activity using getIntent.getextras in to a bundle object. 可以在以下活动中使用放入包对象中的getIntent.getextras访问放置额外的数据。 The bundle object then can be used to return the data using getString using the EXTRA MESSAGE as a key. 然后,可以使用EXTRA MESSAGE作为键,使用getString使用bundle对象返回数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM