Heart beat of any Android device is RAM so called Memory and with god grace mobile devices are blessed with very less heart beats ;). Your app actually decides whether Android device will live or die. So how we can develop effective Android app which let mobile device live its life peacefully. Here is the catch :
Android comes with routine Garbage collection in or der to enhance user Experience. To maintain a functional multi-tasking environment, Android sets a hard limit on the heap size for each app. Dont know what is heap size?? Click here to read. The ex act heap size limit varies between Android devices based on how much RAM the device has available overall. If your app has reached the heap capacity and tries to allocate more memory, it will receive an out Of MemoryError which means your app sucked last heartbeat of Android Device and eventually device lands up in graveyard.
Enums often require more than twice as much memory as static constants. You should strictly avoidusing enums on Android.Another Fact,every class in Java (including anonymous inner classes) uses about 500 bytes of code.No, we do not say that you should use less of classes or something similar, Its is purely ondeveloper how he wants to architect his code in order to take care of memory management but notat cost of un-manageble or un-readble code.
Avoid wasting memory with bitmaps
Use ProGuard to strip out any unneeded code
Use zipalign on your final APK
What if I still go Out Of Memory?
Well, why not ask Android to provide your application some extra memory!!
Request that your application’s processes be created with a large Dalvik heap. This applies to all processes created for the application. It only applies to the first application loaded into a process, if using a shared user Id to allow multiple applications to use a process, they all must use this option consistently or will get unpredictable results.
<android xmlns:android="http://schemas.android.com/apk/res/android"> <manifest> <application android:largeHeap="true"/> </manifest>
To gather more information, look here