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.


Post a Comment