Android To Read

1) Activity, Memory Leaks, Long running task

http://www.androiddesignpatterns.com/2013/04/activitys-threads-memory-leaks.html
http://www.androiddesignpatterns.com/2013/01/inner-class-handler-memory-leak.html

Retained Fragments to handle background tasks.
http://www.androiddesignpatterns.com/2013/04/retaining-objects-across-config-changes.html
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

http://www.androiddesignpatterns.com/2013/04/retaining-objects-across-config-changes.html

https://developer.android.com/guide/topics/resources/runtime-changes.html

Calling 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.

android:configChanges="orientation|screenSize"

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

https://developer.android.com/training/animation/screen-slide.html

http://stackoverflow.com/questions/7766630/changing-viewpager-to-enable-infinite-page-scrolling

http://thehayro.blogspot.de/2013/09/infiniteviewpager-infinite-paging.html


4) Caching – How to use DiskLruCache

https://developer.android.com/training/displaying-bitmaps/cache-bitmap.html

https://android.googlesource.com/platform/libcore/+/jb-mr2-release/luni/src/main/java/libcore/io/DiskLruCache.java

http://stackoverflow.com/questions/21872028/jakewhartons-disklrucache-how-to-implement-with-volley

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s