Android prevent out of memory exception

Well memory out of exception is the common problem for android application. If your application is not memory efficient it will get crashed due to memory exception.

This post does not contain guideline on how to create memory efficient application. This post contain one method which helped my application form getting memory out of exception. i.e to increase the heap size.

#1 Increase heap size.
This is generally not the good way to deal with memory exception. However if your application is ram hungry you can use this.

In AndroidManifiest.xml at application element add android:largeHeap="true".

    android:allowBackup="true"    android:icon="@mipmap/ic_launcher"    android:label="@string/app_name"    android:supportsRtl="true"    android:theme="@style/Theme.AppCompat.Light.NoActionBar"    android:largeHeap="true"    tools:replace="android:icon"    >