Currently, I have a piece of code, which is designed to run both in Android 2.3 and 4+
The code will perform much better (Where it will not have OutOfMemory exceptio
Keep the android:largeHeap="true" attribute in your AndroidManifest.xml. This should be ignored for versions that don't support it. Then, to support older versions, set the heap size using the VMRuntime class (via reflection, if necessary).
More on this topic: How to increase heap size of an android application?