Skip to content Skip to sidebar Skip to footer

Is Parcelable Object Passed Through Bundle Same As Original One?

This is something that has bothered me for a while now. If we have some kind of Parcelable object in our activity and we pass it to fragment using Bundle, I've always thought the

Solution 1:

When you make your object Parcelable and then you pass it into another activity using Intent,something like this:

Intenti=newIntent();
i.putExtra("name_of_extra", myParcelableObject);

the object you receive in another activity or fragment is the exact object you pass it before. you can receive the object in this way:

Intenti= getIntent();
MyParcelablemyParcelableObject= (MyParcelable)i.getParcelableExtra("name_of_extra");

Post a Comment for "Is Parcelable Object Passed Through Bundle Same As Original One?"