Difference between Bundle and putExtra of Intent

Using bundle will create negligible difference in your application. Using a bundle is slightly more manageable and clear. When you are using a putExtra, you are using a bundle anyway, you can see here that Intent store data passed through putExtra internally as Bundle-

public Intent putExtra(String name, String value) {
if (mExtras == null) {
mExtras
= new Bundle();
}
mExtras
.putString(name, value);
return this;
}

You are using bundle anyway, there is no alternative.
Well there’s a very stupid alternative of using shared preferences.
The only time i have found Bundles more useful is when i have a bunch of variables that i need to pass between multiple activities. I can easily pass around the same bundle every time instead of passing around single values.

Don’t miss these tips!

We don’t spam! Read our privacy policy for more info.

You’ve been successfully subscribed to our newsletter! See you on the other side!

Sharing is caring!

28 thoughts on “Difference between Bundle and putExtra of Intent”

  1. Many thanks for sharing such incredible knowledge. It's really good for your website.
    The info on your website inspires me greatly. This website I'm bookmarked. Maintain it and thanks again.
    I'm really impressed with your writing skills, as smart as the structure of your weblog.
    IVT BlueSoleil Crack

Leave a Comment

Your email address will not be published.

Exit mobile version