title: OutOfMemoryError when inflating a layout
body: <p>I keep seeing this out of memory error in my developer console and I do not know why</p>
  
  <p>log:</p>
  
  <pre><code>android.view.InflateException: Binary XML file line #52: Error inflating class &lt;unknown&gt;
  at android.view.LayoutInflater.createView(LayoutInflater.java:518)
  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:212)
  at android.app.Dialog.setContentView(Dialog.java:421)
  at ecm2.android.MessageDialog.PopUpMessage(MessageDialog.java:90)
  at ecm2.android.MainActivity.PopMessage(MainActivity.java:1830)
  at ecm2.android.MainActivity$10.onItemClick(MainActivity.java:1355)
  at android.widget.AdapterView.performItemClick(AdapterView.java:284)
  at android.widget.ListView.performItemClick(ListView.java:3513)
  at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
  at android.os.Handler.handleCallback(Handler.java:587)
  at android.os.Handler.dispatchMessage(Handler.java:92)
  at android.os.Looper.loop(Looper.java:123)
  at android.app.ActivityThread.main(ActivityThread.java:3703)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:507)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
  at dalvik.system.NativeStart.main(Native Method)
  Caused by: java.lang.reflect.InvocationTargetException
  at java.lang.reflect.Constructor.constructNative(Native Method)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
  at android.view.LayoutInflater.createView(LayoutInflater.java:505)
  ... 24 more
  Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
  at android.content.res.Resources.loadDrawable(Resources.java:1709)
  at android.content.res.Resources.getDrawable(Resources.java:581)
  at android.widget.ScrollView.setOverScrollMode(ScrollView.java:1404)
  at android.view.View.&lt;init&gt;(View.java:1879)
  at android.view.View.&lt;init&gt;(View.java:1921)
  at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:292)
  at android.widget.FrameLayout.&lt;init&gt;(FrameLayout.java:88)
  at android.widget.ScrollView.&lt;init&gt;(ScrollView.java:145)
  at android.widget.ScrollView.&lt;init&gt;(ScrollView.java:141)
  </code></pre>
  
  <p>this is my layout XML</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/layout_root"              
  android:orientation="vertical"
  android:layout_height="match_parent"
  android:padding="2dip" android:paddingTop="2dip" android:layout_width="fill_parent"&gt;
  
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_height="match_parent"
      android:padding="0dip" android:layout_width="fill_parent"&gt;
  
      &lt;RelativeLayout
          android:id="@+id/contentLayout2" 
          android:orientation="vertical" 
          android:padding="0dip" 
          android:layout_height="wrap_content"
          android:layout_gravity="top|left"
          android:background="#000000"
          android:layout_weight="0" android:layout_width="fill_parent"&gt;   
  
          &lt;ImageView 
              android:id="@+id/imgIcon" 
              android:layout_height="wrap_content" 
              android:layout_width="wrap_content"
              android:layout_gravity="top|left" android:contentDescription="@string/desc"&gt;
          &lt;/ImageView&gt;
  
          &lt;TextView 
              android:layout_height="wrap_content" 
              android:text="" 
              android:id="@+id/txtDialogHeader" 
              android:layout_width="match_parent" 
              android:textStyle="bold" 
              android:layout_toRightOf="@id/imgIcon"
              android:paddingLeft="5dip" android:textColor="#ff2525" android:textSize="18dip"&gt;
          &lt;/TextView&gt;
  
          &lt;TextView 
              android:layout_height="wrap_content" 
              android:text="" 
              android:id="@+id/txtDialogTOC" 
              android:layout_width="match_parent" 
              android:layout_toRightOf="@id/imgIcon"
              android:layout_below="@id/txtDialogHeader"
              android:paddingLeft="5dip" android:textSize="19dip" android:textStyle="bold"&gt;
          &lt;/TextView&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;ScrollView    
          android:id="@+id/scrollMessageFrame"  
          android:layout_height="match_parent" 
          android:padding="0dip"
          android:background="#AA0000"
          android:layout_weight="1" android:layout_width="fill_parent"&gt;
  
          &lt;TextView 
              android:layout_height="wrap_content" 
              android:layout_width="match_parent" 
              android:text="" 
              android:id="@+id/lblMessage"  
              android:padding="5dip"
              android:background="#000000"
              android:minHeight="140dip" android:textColor="#f2f2f2" android:textSize="20dip"&gt;
          &lt;/TextView&gt;
  
      &lt;/ScrollView&gt; 
  
      &lt;RelativeLayout
          android:id="@+id/contentLayout3" 
          android:orientation="vertical" 
          android:background="#000000" 
          android:layout_height="wrap_content"
          android:layout_gravity="bottom|center_horizontal" android:gravity="center_horizontal" android:layout_width="match_parent"&gt;
  
          &lt;ImageButton
              android:id="@+id/cmdResponding"
              android:layout_width="62dip"
              android:layout_height="62dip"
              android:layout_marginRight="10dip"
              android:contentDescription="@string/desc"
              android:src="@drawable/responding_ref" android:background="@drawable/responding_up" android:layout_marginTop="5dip" android:layout_marginLeft="5dip"&gt;
  &lt;/ImageButton&gt;
          &lt;ImageButton android:id="@+id/cmdDeclining" android:src="@drawable/declining_ref" android:background="@drawable/declining_up" android:layout_alignTop="@+id/cmdResponding" android:layout_alignBottom="@+id/cmdResponding" android:layout_height="62dip" android:layout_width="62dip" android:layout_marginLeft="3dip" android:layout_toRightOf="@+id/cmdResponding" android:layout_marginRight="10dip" android:contentDescription="@string/desc"&gt;&lt;/ImageButton&gt;
  
          &lt;ImageButton
              android:id="@+id/cmdChiefList"
              android:layout_width="62dip"
              android:layout_height="62dip"
              android:layout_toRightOf="@+id/cmdDeclining" android:background="@drawable/chief_up" android:layout_marginRight="10dip" android:src="@drawable/chief_ref" android:contentDescription="@string/desc" android:layout_marginTop="5dip" android:layout_marginLeft="6dip"/&gt;
  
          &lt;ImageButton android:id="@+id/cmdMapping" android:background="@drawable/globe_up" android:src="@drawable/mapping_ref" android:layout_height="60dip" android:layout_width="60dip" android:layout_marginLeft="2dip" android:layout_toRightOf="@+id/cmdChiefList" android:layout_marginTop="5dip" android:contentDescription="@string/desc"&gt;&lt;/ImageButton&gt;
  
      &lt;/RelativeLayout&gt;
  
  &lt;/LinearLayout&gt;
  
  &lt;Button 
      android:text="" 
      android:textSize="16dip"
      android:layout_height="40dip" 
      android:layout_width="40dip" 
      android:id="@+id/cmdExit" 
      android:background="@drawable/closepopup"
      android:layout_gravity="top|right" android:contentDescription="@string/desc"&gt;
  &lt;/Button&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>the line where the error is, is at the <code>setContentView(r.layout.mylayout)</code>. there are no big images in this layout, most are small <code>imagebuttons</code> 6 images in total <code>(biggest image is 90x90)</code> and a bunch of text in a <code>scrollview</code>. so how can I get around this?</p>