What are retained fragments?

Technology CommunityCategory: AndroidWhat are retained fragments?
VietMX Staff asked 3 years ago

By default, Fragments are destroyed and recreated along with their parent Activity’s when a configuration change occurs. Calling setRetainInstance(true) allows us to bypass this destroy-and-recreate cycle, signaling the system to retain the current instance of the fragment when the activity is recreated.