XML Menu Background Memory Issues

curtismallard

New Member
I'm developing an android game. I use xml files to create 2 menus. The menus work fine when the have the same background, but when they have different backgrounds the program crashes with an OutOfMemoryError.Here is what the two xml files look like:File 1:\[code\]<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="wrap_content" android:gravity="center_horizontal" android:layout_height="wrap_content" android:background="@drawable/background"> Bunch of TextViews\[/code\]File 2 is exactly the same except the background is @drawable/background2The LogCat error I get is:\[code\]E/AndroidRuntime(534): FATAL EXCEPTION: GLThreadE/AndroidRuntime(534): java.lang.OutOfMemoryErrorat android.graphics.Bitmap.nativeCreate(Native Method)at android.graphics.Bitmap.createBitmap(Bitmap.java:605)\[/code\]I'm not really sure how this error relates to me changing the background image, and the problem is not related to the size of the background images that I am using. I tried having one background image of 800KB and there was no problem, but when I try two different background images of around 150KB I get an error.I have an activity that creates the menu:\[code\] public class MenuActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_new); \[/code\]Any help would be greatly appreciated.Thanks
 
Back
Top