我在我的android清单中添加了android:largeHeap =“true”属性,但它似乎没有对我的应用程序的允许内存产生影响。当我在Acer A100(运行android 3.2.1)上运行以下活动时,我得到以下结果:
largeAmount = 256
normalamount = 48
allowedMax = 48
outofmemoryexception allocating the 60mb byte array.
public class TempActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
int largeAmount = manager.getLargeMemoryClass();
int normalAmount = manager.getMemoryClass();
long allowedMax = Runtime.getRuntime().maxMemory()/1024/1024;
byte[] bigarray = new byte[62914560];
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.temp"
android:largeHeap="true"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="11" android:targetSdkVersion="11"/>
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".TempActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
答案 0 :(得分:1)
糟糕,largeHeap属性属于&#34;应用程序&#34;标签