Avoid Memory Leaks and understanding of reference in Android
Memory management is a serious problem for Android development. Memory leaks play a very important role to achieve into it. Memory leak is when an object is no longer being used but unable to be Garbage collected because it is still being referenced some other places in the application. As a result, this unused object is occupying the memory resource even though it is not being used by the application. Too much unused objects inside application will cause not enough memory left for other active objects and finally leads application crash with OutOfMemoryError. That means to take care of memory; you might need some different strategies such as: Search for memory leaks (Even when things aren't failing). Keep track of your references. Different Ways to Memory Leak in Android Below are few different ways which can lead the memory leak problem. So when you come across following situations, make sure you handle it properly- Static Activities or Views Inner C