Peter
Peter

Reputation: 843

Android Outofmemory error, external memory

I created an emulator with Android 2.2 kernel and max VM heap size =24Mb. When an activity runs on it, the logcat show outofmemory error:

"861984-byte external allocation too larger for this process"

Can I know what does "external allocation" here mean? Is this the "external memory"? This activity call setContentView(R.layout.main).

The layout 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>

The dimension of image splash.png is 640*960

Before Honeycomb, pixel data of image was stored in "native memory". Is "native memory" the same as "external memory"?

Upvotes: 1

Views: 692

Answers (2)

Siklab.ph
Siklab.ph

Reputation: 1031

Read this. I solved my memory issue in the setContentView call by creating my own theme (using a tiled drawable) rather than using a default Android theme then setting a large image as background that caused redrawing of the layout which is wasteful to both memory and CPU performance.

Upvotes: 0

Asish AP
Asish AP

Reputation: 4441

set your imageview to null each time when you load the new image.Or use recycle() method to your imageview object each time when you load the new image

Upvotes: 3

Related Questions