1) Activity, Memory Leaks, Long running task
Retained Fragments to handle background tasks.
The difference between static and non-static inner classes is subtle, but is something every Android developer should understand. What’s the bottom line? Avoid using non-static inner classes, anonymous inner classes in an activity if instances of the inner class could outlive the activity’s lifecycle.
Instead, prefer static inner classes and hold a weak reference to the activity inside.
2) Handling Configuration Changes with Fragments
Fragment#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.
It’s not a good practice to use configChanges to prevent destruction and recreation of activity on configuration change.
To handle configuration changes you can implement function onConfigurationChanged().
When you declare your activity to handle a configuration change, you are responsible for resetting any elements for which you provide alternatives. If you declare your activity to handle the orientation change and have images that should change between landscape and portrait, you must re-assign each resource to each element during onConfigurationChanged().
3) Infinite View Pager
4) Caching – How to use DiskLruCache