Enable android:largeHeap in Android 4, and disable it in Android 2.3

后端 未结 5 746
粉色の甜心
粉色の甜心 2020-12-07 23:09

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

5条回答
  •  青春惊慌失措
    2020-12-07 23:56

    1. 1.Build project with target Android 3.0 (API 11) or above. (Project properties - Android - Project Build Target - select above API level 11)

    2. in Manifest file, Change the uses-sdk value as following

      < uses-sdk android:minSdkVersion="10" android:targetSdkVersion="11" />

    For prior versions of Android 3.0, you can use VMRuntime class for memory manipulations.

提交回复
热议问题