Error on android with different costum button
<p>i have a error on my android project that i cant solve.</p>

<p>I have a game menu layout in one xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RootView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/gamemenu_background"
    android:orientation="vertical" &gt;

    &lt;Button
        android:id="@+id/gaveup_button"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:background="@drawable/gaveup_button"&gt;

    &lt;/Button&gt;

    &lt;Button
        android:id="@+id/choice_a_button"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:background="@drawable/choice_a_button"&gt;   

    &lt;/Button&gt;

    &lt;Button
        android:id="@+id/choice_b_button"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:background="@drawable/choice_b_button"/&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>So for each button i have an xml and an image in folder drawable:</p>

<p>choice_a_button_xml.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;selector xmlns:android="http://schemas.android.com/apk/res/android" &gt;
    &lt;item android:drawable="@drawable/choice_a_button"&gt;&lt;/item&gt;
&lt;/selector&gt;
</code></pre>

<p>choice_b_button_xml.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;selector xmlns:android="http://schemas.android.com/apk/res/android" &gt;
    &lt;item android:drawable="@drawable/choice_b_button"&gt;&lt;/item&gt;
&lt;/selector&gt;
</code></pre>

<p>In layout manager of eclipse de layout are good but when i run the app on a virtual device i have an error and app not start:</p>

<pre><code>05-15 01:22:52.284: D/dalvikvm(341): GC freed 605 objects / 48664 bytes in 166ms
05-15 01:22:52.446: D/dalvikvm(341): GC freed 59 objects / 2304 bytes in 46ms
05-15 01:22:52.814: D/dalvikvm(341): GC freed 138 objects / 6344 bytes in 42ms
05-15 01:22:53.124: D/dalvikvm(341): GC freed 48 objects / 1864 bytes in 44ms
05-15 01:22:53.724: E/dalvikvm-heap(341): 3686400-byte external allocation too large for this process.
05-15 01:22:53.724: E/(341): VM won't let us allocate 3686400 bytes
05-15 01:22:53.724: D/skia(341): --- decoder-&gt;decode returned false
05-15 01:22:53.735: D/AndroidRuntime(341): Shutting down VM
05-15 01:22:53.735: W/dalvikvm(341): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
05-15 01:22:53.735: E/AndroidRuntime(341): Uncaught handler: thread main exiting due to uncaught exception
05-15 01:22:53.754: E/AndroidRuntime(341): java.lang.RuntimeException: Unable to start activity ComponentInfo{sal.app/sal.app.SALActivity}: android.view.InflateException: Binary XML file line #29: Error inflating class &lt;unknown&gt;
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.app.ActivityThread.access$2200(ActivityThread.java:119)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.os.Handler.dispatchMessage(Handler.java:99)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.os.Looper.loop(Looper.java:123)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.app.ActivityThread.main(ActivityThread.java:4363)
05-15 01:22:53.754: E/AndroidRuntime(341):  at java.lang.reflect.Method.invokeNative(Native Method)
05-15 01:22:53.754: E/AndroidRuntime(341):  at java.lang.reflect.Method.invoke(Method.java:521)
05-15 01:22:53.754: E/AndroidRuntime(341):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
05-15 01:22:53.754: E/AndroidRuntime(341):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-15 01:22:53.754: E/AndroidRuntime(341):  at dalvik.system.NativeStart.main(Native Method)
05-15 01:22:53.754: E/AndroidRuntime(341): Caused by: android.view.InflateException: Binary XML file line #29: Error inflating class &lt;unknown&gt;
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.view.LayoutInflater.createView(LayoutInflater.java:513)
05-15 01:22:53.754: E/AndroidRuntime(341):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-15 01:22:53.754: E/AndroidRuntime(341):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.app.Activity.setContentView(Activity.java:1622)
05-15 01:22:53.754: E/AndroidRuntime(341):  at sal.app.SALActivity.onCreate(SALActivity.java:23)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
05-15 01:22:53.754: E/AndroidRuntime(341):  ... 11 more
05-15 01:22:53.754: E/AndroidRuntime(341): Caused by: java.lang.reflect.InvocationTargetException
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.widget.Button.&lt;init&gt;(Button.java:65)
05-15 01:22:53.754: E/AndroidRuntime(341):  at java.lang.reflect.Constructor.constructNative(Native Method)
05-15 01:22:53.754: E/AndroidRuntime(341):  at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.view.LayoutInflater.createView(LayoutInflater.java:500)
05-15 01:22:53.754: E/AndroidRuntime(341):  ... 22 more
05-15 01:22:53.754: E/AndroidRuntime(341): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:447)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.content.res.Resources.loadDrawable(Resources.java:1705)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.view.View.&lt;init&gt;(View.java:1850)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.widget.TextView.&lt;init&gt;(TextView.java:326)
05-15 01:22:53.754: E/AndroidRuntime(341):  at android.widget.Button.&lt;init&gt;(Button.java:69)
05-15 01:22:53.754: E/AndroidRuntime(341):  ... 26 more
05-15 01:22:53.774: I/dalvikvm(341): threadid=7: reacting to signal 3
05-15 01:22:53.774: E/dalvikvm(341): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
</code></pre>

<p>Whats happen there? This error only ocurre in virtual devices with large screens.</p>

<p>This app work if i set Max VM application heap size of my virtual device to 48. But this is too much..There is any way to put program consumes less memory?</p>

<p>please help me</p>
