title: Error inflating checkbox
body: <p>I am having weird stack trace from my application in the android market. 
  I have a view switcher which contains two views, one of them contains a checkbox. </p>
  
  <p>I am getting this stack trace AdDetailView beeing a custom view.  </p>
  
  <pre><code>  android.view.InflateException: Binary XML file line #29: Error inflating class android.widget.CheckBox
    at android.view.LayoutInflater.createView(LayoutInflater.java:513)
    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:382)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    at com.yakaz.view.AdDetailView.init(AdDetailView.java:67)
    at com.yakaz.view.AdDetailView.&lt;init&gt;(AdDetailView.java:78)
  </code></pre>
  
  <p>This happens in the following view contructor : </p>
  
  <pre><code>private void init(Context context) {
      LayoutInflater li = (LayoutInflater) context
              .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      li.inflate(R.layout.ad_detail_view, this);
      setOrientation(LinearLayout.VERTICAL);
  }
  
  public AdDetailView(Context context, AttributeSet attrs) {
      super(context, attrs);
      init(context);
  }
  </code></pre>
  
  <p>The line 67 is the inflate line.</p>
  
  <p>The problem is that i can't reproduce the problem, on emulator or device. 
  Any pointers ? </p>
  
  <p>Here is the ad_detail_view.xml   </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;merge xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;TextView android:layout_width="fill_parent"
      android:layout_height="wrap_content" android:id="@+id/preview_warning"
      style="@style/Notification" android:text="@string/this_is_only_a_preview"
      android:visibility="gone" /&gt;
  
  &lt;ScrollView android:layout_width="fill_parent"
      android:fadingEdge="none" android:layout_height="fill_parent"
      android:layout_weight="1" android:fillViewport="true" android:id="@+id/scrolls"&gt;
      &lt;LinearLayout android:layout_width="fill_parent"
          android:layout_height="fill_parent" android:orientation="vertical"&gt;
  
          &lt;include layout="@layout/action_bar" /&gt;
  
          &lt;LinearLayout android:orientation="horizontal"
              android:layout_width="fill_parent" android:layout_height="wrap_content"
              android:paddingTop="10dp" android:paddingLeft="10dp"
              android:paddingRight="10dp"&gt;
              &lt;!--  tags --&gt;
              &lt;LinearLayout android:id="@+id/tagsLayout"
                  android:orientation="horizontal" android:layout_width="fill_parent"
                  android:layout_weight="1" android:layout_height="wrap_content" /&gt;
              &lt;CheckBox android:id="@+id/save_button" style="@style/StarButton"
                  android:layout_marginRight="10sp" /&gt;
          &lt;/LinearLayout&gt;
  
  
          &lt;!--  meta --&gt;
          &lt;Button android:id="@+id/meta" style="@style/Meta"
              android:layout_width="wrap_content" android:layout_height="wrap_content"
              android:layout_marginLeft="10dp"/&gt;
  
  
          &lt;!-- pictures --&gt;
          &lt;LinearLayout android:orientation="horizontal"
              android:layout_width="fill_parent" android:layout_height="wrap_content"
              android:gravity="center" android:id="@+id/gallery_container"&gt;
              &lt;Gallery android:id="@+id/gallery" android:layout_width="fill_parent"
                  android:layout_height="wrap_content" /&gt;
          &lt;/LinearLayout&gt;
  
  
          &lt;!--  padded layout --&gt;
          &lt;LinearLayout android:layout_width="fill_parent"
              android:layout_height="wrap_content" android:orientation="vertical"
              android:padding="5dp"&gt;
  
              &lt;!-- summary --&gt;
              &lt;TextView android:id="@+id/summary" style="@style/AdDetailSummary"
                  android:layout_width="fill_parent" android:layout_height="wrap_content"
                  android:paddingBottom="10dp" /&gt;
  
  
          &lt;/LinearLayout&gt;
  
  
          &lt;!--  tab --&gt;
          &lt;LinearLayout android:layout_width="fill_parent"
              android:orientation="vertical" android:layout_height="wrap_content"
              android:background="@drawable/bottom_green_bar" android:paddingLeft="10dp"&gt;
              &lt;TextView android:layout_width="wrap_content" android:id="@+id/tab_title"
                  android:gravity="center" android:layout_height="wrap_content"
                  android:text="@string/member_profile" style="@style/TabLabel" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;!-- user detail --&gt;
          &lt;LinearLayout android:layout_width="fill_parent"
              android:orientation="vertical" android:layout_height="wrap_content"
              android:background="@color/very_light_gray" android:paddingBottom="10dp"&gt;
              &lt;!--  user item --&gt;
  
              &lt;include layout="@layout/user_item" /&gt;
              &lt;include layout="@layout/website_item" /&gt;
  
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/ScrollView&gt;
  &lt;/merge&gt;
  </code></pre>
  
  <p>style.xml : </p>
  
  <pre><code>&lt;style name="StarButton"&gt;
      &lt;item name="android:background"&gt;@drawable/bk_star_button&lt;/item&gt;
      &lt;item name="android:layout_width"&gt;30dp&lt;/item&gt;
      &lt;item name="android:layout_height"&gt;30dp&lt;/item&gt;
      &lt;item name="android:button"&gt;@android:id/empty&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>bk_star_button.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/btn_star_big_off"
        android:state_checked="false"/&gt;
      &lt;item android:drawable="@drawable/btn_star_big_on"
        android:state_checked="true"/&gt;          
  &lt;/selector&gt;
  </code></pre>
  
  <p>here is another layout that as the exact same exception raised on some device : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent" android:layout_height="fill_parent"
  android:orientation="vertical" android:background="@drawable/bk_gradient"&gt;
      &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent" android:layout_height="wrap_content"
          android:gravity="left|center_vertical" style="@style/TopBar"
          android:id="@+id/titlebar"&gt;
          &lt;ImageView android:src="@drawable/logo" android:layout_width="wrap_content"
          android:layout_height="wrap_content" android:background="@null"
          android:layout_alignParentLeft="true" /&gt;
  
          &lt;FrameLayout android:layout_width="wrap_content"
          android:layout_height="wrap_content" android:layout_centerVertical="true"
          android:paddingLeft="8dp" android:id="@+id/search_progressbar"
          android:visibility="gone"&gt;
              &lt;ProgressBar android:layout_width="wrap_content"
              android:layout_height="wrap_content" 
              style="@style/ProgressBarMedium" /&gt;
          &lt;/FrameLayout&gt;
  
      &lt;LinearLayout android:id="@+id/buttons_container"
      android:gravity="right|center_vertical" android:layout_width="fill_parent"
      android:layout_height="fill_parent" /&gt;
  &lt;/LinearLayout&gt;
      ....
  &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>the code that raises the exception : </p>
  
  <pre><code>public static CompoundButton addTitleBarCompoundButton(Context context,
          View titleBar, CharSequence label, boolean isChecked) {
      if (!(titleBar instanceof ViewGroup))
          return null;
  
      ViewGroup group = (ViewGroup) titleBar
              .findViewById(R.id.buttons_container);
  
      // We attach to root during the inflating process othersize layout_
      // parameters in the style are ignored
      LayoutInflater.from(context).inflate(R.layout.topbar_toggle_button,
              group, true);
  
      // Get the result, which is the last child of the group
      CompoundButton result = (CompoundButton) group.getChildAt(group
              .getChildCount() - 1);
      result.setChecked(isChecked);
  
      // Set the text
      result.setText(label);
      return result;
  }
  </code></pre>
  
  <p>topbar_toggle_button.xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;CheckBox xmlns:android="http://schemas.android.com/apk/res/android" style="@style/BarButton.Toggle"/&gt;
  </code></pre>