Android Outofmemory错误,外部内存

Android Outofmemory错误,外部内存,android,out-of-memory,Android,Out Of Memory,我用Android 2.2内核创建了一个模拟器,最大VM堆大小=24Mb。当活动在其上运行时,logcat将显示outofmemory错误: "861984-byte external allocation too larger for this process" 我能知道这里的“外部分配”是什么意思吗?这是“外部存储器”吗?此活动调用setContentView(R.layout.main) 布局main.xml: <?xml version="1.0" encoding="utf-8

我用Android 2.2内核创建了一个模拟器,最大VM堆大小=
24Mb
。当活动在其上运行时,logcat将显示outofmemory错误:

"861984-byte external allocation too larger for this process"
我能知道这里的“外部分配”是什么意思吗?这是“外部存储器”吗?此活动调用setContentView(R.layout.main)

布局main.xml:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/login_bg"
>
<ImageView  
android:layout_width="190dp" 
android:layout_height="50dp" 
android:scaleType = "fitXY"
android:layout_gravity="center"
android:src="@drawable/login_btn_fb"
android:id="@+id/facebookconnect"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility = "visible"
android:src="@drawable/splash"
android:scaleType = "fitXY"
android:id="@+id/splashscreen"
/>
</FrameLayout>

image splash.png的尺寸是
640*960


在蜂窝状之前,图像的像素数据存储在“本机内存”中。“本机内存”与“外部内存”相同吗?

每次加载新图像时,将imageview设置为空。或者每次加载新图像时,对imageview对象使用recycle()方法。我在
setContentView
调用中解决了内存问题,创建了自己的主题(使用平铺绘图),而不是使用默认的Android主题,然后将一个大图像设置为背景,从而导致重新绘制布局,这对内存和CPU性能都是浪费

我认为您正在使用位图类和bitmapfactory类对象在imageview中显示图像。?是吗?不是。我只是使用setContentView(R.layout.main)您试图在imageview中加载多张图片。对吗?你能把你的密码寄出去吗。?每次加载新图像时,必须释放imageview的对象。通过编辑AVD增加堆大小。