Could someone please explain to me what is the difference between getExtras()
and getBundleExtras()
?
getBundleExtra("String")
gets a bundle named String
.
getExtras()
gets a bundle with all of the items placed into the array.
A bundle can be placed using a putExtra(Bundle, String tag)
command, so the getBundleExtra()
will return that value.
Worth notting is the fact that getExtras()
returns copy of the all items placed in the intent, its implementation looks like this:
4433 public Bundle getExtras() {
4434 return (mExtras != null)
4435 ? new Bundle(mExtras)
4436 : null;
4437 }
so its not a good idea to call intent.getExtras().putInt(...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With