title: android.view.InflateException: Binary XML file line #51: Error inflating class com.android.internal.widget.DialogTitle
body: <p>I get the following error, or a similar error, every time my application tries to display a dialog fragment or particular layout:</p>
  
  <pre><code>11-22 10:20:48.993: E/AndroidRuntime(15514): FATAL EXCEPTION: main
  11-22 10:20:48.993: E/AndroidRuntime(15514): android.view.InflateException: Binary XML   file line #51: Error inflating class com.android.internal.widget.DialogTitle
  11-22 10:20:48.993: E/AndroidRuntime(15514): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:313)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at com.android.internal.app.AlertController.installContent(AlertController.java:241)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.app.AlertDialog.onCreate(AlertDialog.java:336)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.app.Dialog.dispatchOnCreate(Dialog.java:351)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.app.Dialog.show(Dialog.java:256)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.support.v4.app.DialogFragment.onStart(DialogFragment.java:385)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.support.v4.app.Fragment.performStart(Fragment.java:1484)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:941)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:429)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.os.Handler.handleCallback(Handler.java:615)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.os.Handler.dispatchMessage(Handler.java:92)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.os.Looper.loop(Looper.java:137)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.app.ActivityThread.main(ActivityThread.java:4921)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at java.lang.reflect.Method.invokeNative(Native Method)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at java.lang.reflect.Method.invoke(Method.java:511)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at dalvik.system.NativeStart.main(Native Method)
  11-22 10:20:48.993: E/AndroidRuntime(15514): Caused by: java.lang.reflect.InvocationTargetException
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at java.lang.reflect.Constructor.constructNative(Native Method)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.view.LayoutInflater.createView(LayoutInflater.java:587)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    ... 28 more
  11-22 10:20:48.993: E/AndroidRuntime(15514): Caused by: java.lang.ArrayIndexOutOfBoundsException: length=43; index=82
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.content.res.StringBlock.get(StringBlock.java:64)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.content.res.XmlBlock$Parser.getPooledString(XmlBlock.java:458)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.content.res.TypedArray.loadStringValueAt(TypedArray.java:720)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.content.res.TypedArray.getText(TypedArray.java:96)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.widget.TextView.&lt;init&gt;(TextView.java:848)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at android.widget.TextView.&lt;init&gt;(TextView.java:588)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    at com.android.internal.widget.DialogTitle.&lt;init&gt;(DialogTitle.java:38)
  11-22 10:20:48.993: E/AndroidRuntime(15514):    ... 31 more
  </code></pre>
  
  <p>The layout I am trying to display is:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;RelativeLayout
          android:id="@+id/titlelay"
          android:layout_width="match_parent"
          android:layout_height="@dimen/titlebar"
          android:background="@color/green"
          android:padding="@dimen/small" &gt;
  
          &lt;TextView
              android:id="@+id/textView8"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_centerInParent="true"
              android:textSize="@dimen/text_big"
              android:textStyle="bold" /&gt;
  
          &lt;Button
              android:id="@+id/problem_button"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentRight="true"
              android:layout_alignParentTop="true"
              android:layout_marginRight="@dimen/ten_pad"
              android:background="#F00"
              android:textSize="@dimen/text_medium"
              android:visibility="gone" /&gt;
  
          &lt;Button
              android:id="@+id/logout_button"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentLeft="true"
              android:layout_alignParentTop="true"
              android:layout_marginLeft="16dp"
              android:textSize="@dimen/text_medium" /&gt;
      &lt;/RelativeLayout&gt;
  
      &lt;!-- Login form --&gt;
  
      &lt;TextView
          android:id="@+id/warning_text"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_below="@+id/titlelay"
          android:layout_gravity="center_horizontal"
          android:textColor="#FFF"
          android:visibility="gone" /&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="fill_parent"
          android:layout_below="@+id/warning_text"
          android:layout_margin="@dimen/padding_value"
          android:gravity="center_vertical"
          android:orientation="vertical"
          android:padding="@dimen/padding_value" &gt;
  
          &lt;Button
              android:id="@+id/herds_button"
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_gravity="center_horizontal"
              android:layout_marginBottom="@dimen/twenty"
              android:layout_weight="1"
              android:textSize="@dimen/text_medium"
              android:textStyle="bold" /&gt;
  
          &lt;Button
              android:id="@+id/livestock"
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_gravity="center_horizontal"
              android:layout_marginBottom="@dimen/twenty"
              android:layout_weight="1"
              android:textSize="@dimen/text_medium"
              android:textStyle="bold" /&gt;
  
          &lt;Button
              android:id="@+id/addHoldings"
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_gravity="center_horizontal"
              android:layout_marginBottom="@dimen/twenty"
              android:layout_weight="1"
              android:textSize="@dimen/text_medium"
              android:textStyle="bold" /&gt;
  
          &lt;Button
              android:id="@+id/options"
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_gravity="center_horizontal"
              android:layout_marginBottom="@dimen/twenty"
              android:layout_weight="1"
              android:textSize="@dimen/text_medium"
              android:textStyle="bold" /&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>This started occurring after I did some work defining style, color and dimension resources. I copied some layouts and resource files to another application, edited them there to get a new look, and copied them back into the main project. I have since (as far as I am aware) removed all those changes, but the problem still happens. </p>
  
  <p>Another bizarre behavior is that an EditText in one functioning activity, that should be empty, is now filled with res/color/search_url_text_holo.xml.</p>
  
  <p>I thought it might be that R.java had been corrupted. I've since deleted R, cleaned my project and rebuilt the project but this has not fixed the problem.</p>
  
  <p>I'm really stumped. Any help at all would be great. Just ask if you need any more detail.</p>
  
  <p>Thanks a lot.</p>
  
  <p>Edit 1:
  Here is the java code corresponding to the opening on the dialog:</p>
  
  <pre><code>private void arable() {
          dialogs.Arable arable = new dialogs.Arable();
          arable.show(getSupportFragmentManager(), "tag");
  }
  
  package dialogs;
  
  import rich.farming.fertiliserrecommendations.R;
  import admin.reference.Crop;
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.app.Dialog;
  import android.content.DialogInterface;
  import android.os.Bundle;
  import android.support.v4.app.DialogFragment;
  import appmethods.Starters;
  
  public class Arable extends DialogFragment {
  
      private static Activity act;
      private boolean cancelled;
  
      @Override
      public Dialog onCreateDialog(Bundle savedInstanceState) {
  
          act = getActivity();
          int Items = R.array.Menu_arable;
          cancelled = false;
  
          AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
          builder.setTitle("Select").setItems(Items,
                  new DialogInterface.OnClickListener() {
  
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                          System.out.println("(Dialogs.Arable.onClick which = "
                                  + which);
                          switch (which) {
  
                          default:
                              cancelled = true;
                              break;
                          }
                          dismiss();
                          if (!cancelled)
                              act.finish();
                      }
  
                  });
  
          return builder.create();
      }
  </code></pre>
  
  <p>This is just one example. There are multiple dialogs that are opened in this way. They were working great until recently. I can also post the menu resources if you like, but they have not changed.</p>