As mentioned in the title, both bundle and intent can store key-value pair data. In logarithmic cases, just use intent directly. Why is there such a combination of intent+bundle?
世界只因有你2017-05-16 13:37:37
Even if you use intent to pass it, a bundle will be automatically generated.
So in fact, bundles are used
天蓬老师2017-05-16 13:37:37
The first floor has already answered it correctly, I just posted the source code:
/**
* Add extended data to the intent. The name must include a package
* prefix, for example the app com.android.contacts would use names
* like "com.android.contacts.ShowAll".
*
* @param name The name of the extra data, with package prefix.
* @param value The String data value.
*
* @return Returns the same Intent object, for chaining multiple calls
* into a single statement.
*
* @see #putExtras
* @see #removeExtra
* @see #getStringExtra(String)
*/
public Intent putExtra(String name, String value) {
if (mExtras == null) {
mExtras = new Bundle();
}
mExtras.putString(name, value);
return this;
}