May the Fragment be with you.

I have come across lots of questions on the internet on how to store data between configuration changes. Activities are destroyed, on a configuration change, so any local data dependent on an Activity will be destroyed, including any references that AsyncTasks thread  tasks have attached to your thread.

There are many ways of working around the thread issue and ways of storing data that can be restored when the Activity is recreated after the configuration change. The best explanation I have found and makes it so clear is at this website Android Design Patterns. This method uses RetainedFragments, and Interfaces (YAY for Interfaces) so have a look and hopefully you can use this pattern in your Apps.

One thought on “May the Fragment be with you.

Leave a comment