title: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
body: <p>I am developing a simple android apllication and just completed the home screen. Now if the orientation of the screen changes more than two times, it is throwing the error and application is getting crashed abrubptly.</p>
  <p>Here is my Java Class:</p>
  <pre><code>public class PasswordActivity extends Activity implements OnClickListener {
    Button login;  
    Button forgot;
    Button register;  
  
    private static final String PREFERENCES = &quot;prefs&quot;;
    private static final String PREFERENCES_NAME = &quot;pref_name&quot;; 
    SharedPreferences settings;
    private Cursor c;
  
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main); 
        login=(Button)findViewById(R.id.login_login);
        login.setOnClickListener(this);
        register=(Button)findViewById(R.id.login_register);
        register.setOnClickListener(this);
       
    }
    public void onClick(View v) {
    } 
  }
  </code></pre>
  <p>And this is my Xml Code:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:orientation=&quot;vertical&quot;    
    android:background=&quot;@drawable/listpic&quot;&gt;
  
    &lt;LinearLayout 
      android:layout_width=&quot;fill_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:orientation=&quot;horizontal&quot;
      android:paddingTop=&quot;5dp&quot;
      android:paddingLeft=&quot;3dp&quot;
      android:paddingRight=&quot;3dp&quot;&gt;  
  
      &lt;TextView 
       android:layout_width=&quot;fill_parent&quot;
       android:layout_weight=&quot;0.75&quot;
       android:layout_height=&quot;wrap_content&quot;
       android:text=&quot;@string/login_user_name&quot;
       android:textStyle=&quot;bold&quot;/&gt;
  
      &lt;EditText 
       android:layout_width=&quot;fill_parent&quot;
       android:layout_height=&quot;wrap_content&quot;
       android:layout_weight=&quot;0.25&quot;
       android:id=&quot;@+id/login_user_name&quot;
       android:inputType=&quot;text&quot;/&gt;
    &lt;/LinearLayout&gt;
  
    &lt;LinearLayout 
       android:layout_width=&quot;fill_parent&quot;
       android:layout_height=&quot;wrap_content&quot;
       android:orientation=&quot;horizontal&quot;
       android:paddingLeft=&quot;3dp&quot;
       android:paddingRight=&quot;3dp&quot;&gt;  
  
       &lt;TextView 
        android:layout_width=&quot;fill_parent&quot;
        android:layout_weight=&quot;0.75&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:text=&quot;@string/login_password&quot;
        android:textStyle=&quot;bold&quot;/&gt;
  
       &lt;EditText 
        android:layout_width=&quot;fill_parent&quot;
        android:layout_height=&quot;wrap_content&quot;
        android:layout_weight=&quot;0.25&quot;
        android:inputType=&quot;textPassword&quot;
        android:id=&quot;@+id/login_password&quot;/&gt;
    &lt;/LinearLayout&gt;
  
    &lt;LinearLayout 
       android:layout_width=&quot;fill_parent&quot;
       android:layout_height=&quot;wrap_content&quot;
       android:orientation=&quot;horizontal&quot;
       android:paddingLeft=&quot;3dp&quot;
       android:paddingRight=&quot;3dp&quot;&gt;  
  
       &lt;Button 
        style=&quot;@style/left_button&quot;
        android:text=&quot;@string/login_submit&quot;
        android:id=&quot;@+id/login_login&quot;/&gt;
  
       &lt;Button 
         style=&quot;@style/right_button&quot;
         android:id=&quot;@+id/login_register&quot;
         android:text=&quot;@string/register&quot;/&gt;
  
    &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  <p>Log Cat Details:</p>
  <pre><code>10-21 12:05:59.982: D/dalvikvm(622): GC_EXTERNAL_ALLOC freed 774 objects / 56240 bytes in 61ms
  10-21 12:06:15.031: D/dalvikvm(622): GC_EXTERNAL_ALLOC freed 737 objects / 30992 bytes in 59ms
  10-21 12:06:18.022: E/dalvikvm-heap(622): 7596000-byte external allocation too large for this process.
  10-21 12:06:18.022: E/GraphicsJNI(622): VM won't let us allocate 7596000 bytes
  10-21 12:06:18.043: D/AndroidRuntime(622): Shutting down VM
  10-21 12:06:18.043: W/dalvikvm(622): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
  10-21 12:06:18.092: E/AndroidRuntime(622): FATAL EXCEPTION: main
  10-21 12:06:18.092: E/AndroidRuntime(622): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ravi.password/com.ravi.password.PasswordActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class &lt;unknown&gt;
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.app.ActivityThread.main(ActivityThread.java:4627)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at java.lang.reflect.Method.invokeNative(Native Method)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at java.lang.reflect.Method.invoke(Method.java:521)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at dalvik.system.NativeStart.main(Native Method)
  10-21 12:06:18.092: E/AndroidRuntime(622): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class &lt;unknown&gt;
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.view.LayoutInflater.createView(LayoutInflater.java:513)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.app.Activity.setContentView(Activity.java:1647)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at com.ravi.password.PasswordActivity.onCreate(PasswordActivity.java:34)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  10-21 12:06:18.092: E/AndroidRuntime(622):  ... 12 more
  10-21 12:06:18.092: E/AndroidRuntime(622): Caused by: java.lang.reflect.InvocationTargetException
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.widget.LinearLayout.&lt;init&gt;(LinearLayout.java:115)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at java.lang.reflect.Constructor.constructNative(Native Method)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.view.LayoutInflater.createView(LayoutInflater.java:500)
  10-21 12:06:18.092: E/AndroidRuntime(622):  ... 22 more
  10-21 12:06:18.092: E/AndroidRuntime(622): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.graphics.Bitmap.nativeCreate(Native Method)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
  10-21 12:06:18.092: E/AndroidRuntime(622):  at android.view.ViewGroup.&lt;init&gt;(ViewGroup.java:285)
  10-21 12:06:18.092: E/AndroidRuntime(622):  ... 26 more 
  </code></pre>
  <p>Images used are of very small size around 5kb.</p>