What is Bundle? What does it contain in onCreate() of your activity?

Answer: Bundle contain previous savedInstantceState

Description: Bundle is a data holder, which holds data to be passed between activities.
In case of forceful closing of an activity, android will save all its UI states and transient states so that they can be used to restore the activity's states later. This saved states will be passed via Bundle in onCreate() function to restore its states once android recreates a killed activity.
EG: this will happen in case of low memory or configuration changes like rotating the phone.

No comments:

Post a Comment