title: Android: Error inflating class PreferenceScreen
body: <p>Please help me out here, I'm hitting brick wall for the last two days and can't figure it out.</p>
  
  <p>I have a simple PreferenceFragment and would like to inflate it from an Activity.</p>
  
  <p>Here is the res/xml/preferences.xml:</p>
  
  <pre><code>&lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
      android:key="preferences"&gt;
  &lt;PreferenceCategory
          android:title="@string/notification_basic"
          android:key="notification"&gt;
      &lt;CheckBoxPreference
              android:key="enable_notification"
              android:summary="@string/enable_notification"
              android:title="@string/notification_title"
              android:defaultValue="false"&gt;
      &lt;/CheckBoxPreference&gt;
      &lt;CheckBoxPreference
              android:key="enable"
              android:summary="@string/enable_instant_notification"
              android:title="@string/notify_me_instantly"
              android:dependency="enable_notification"
              android:defaultValue="false"&gt;
      &lt;/CheckBoxPreference&gt;
  &lt;/PreferenceCategory&gt;
  &lt;PreferenceCategory
          android:title="@string/sign_up_notify_me_where_section"
          android:key="locations"&gt;
      &lt;MultiSelectListPreference
              android:dialogTitle="@string/sign_up_notify_me_where_title"
              android:key="location"
              android:summary="@string/sign_up_notify_me_where"
              android:title="@string/sign_up_notify_me_where_title"
              android:entries="@array/locations"
              android:entryValues="@array/locations_values"
              android:defaultValue="@array/empty_array"
              android:dependency="enable_notification"
              /&gt;
  &lt;/PreferenceCategory&gt;
  &lt;PreferenceCategory
          android:title="@string/sign_up_notify_me_type_section"
          android:key="types"&gt;
      &lt;MultiSelectListPreference
              android:dialogTitle="@string/sign_up_notify_me_type_title"
              android:key="type"
              android:summary="@string/sign_up_notify_me_type"
              android:title="@string/sign_up_notify_me_type_title"
              android:entries="@array/types"
              android:entryValues="@array/types_values"
              android:defaultValue="@array/empty_array"
              android:dependency="enable_notification"
              /&gt;
  &lt;/PreferenceCategory&gt;
  &lt;PreferenceCategory
          android:title="@string/sign_up_notify_me_who_section"
          android:key="units"&gt;
      &lt;MultiSelectListPreference
              android:dialogTitle="@string/sign_up_notify_me_who_title"
              android:key="units"
              android:summary="@string/sign_up_notify_me_who"
              android:title="@string/sign_up_notify_me_who_title"
              android:entries="@array/units"
              android:entryValues="@array/units_values"
              android:defaultValue="@array/empty_array"
              android:dependency="enable_notification"
              /&gt;
      &lt;/PreferenceCategory&gt;
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>The Activity:</p>
  
  <pre><code>public class HomeActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.home);
      FragmentManager fragmentManager = getFragmentManager();
      FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
      fragmentTransaction.add(R.id.fragment_container, new SignUpPreferenceFragment());
      fragmentTransaction.commit();
      }
  }
  </code></pre>
  
  <p>The layout of the activity:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:id="@+id/home_layout"&gt;
  &lt;FrameLayout android:layout_height="wrap_content"
               android:layout_width="wrap_content"
               android:id="@+id/fragment_container"
          /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And finally the stacktrace:</p>
  
  <pre><code>04-05 20:11:07.641: ERROR/AndroidRuntime(5731): FATAL EXCEPTION: main
      java.lang.RuntimeException: Unable to start activity     ComponentInfo{com.soid.client.activities/com.soid.client.activities.HomeActivity}:     android.view.InflateException: Binary XML file line #1: Error inflating class     PreferenceScreen
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2355)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2391)
      at android.app.ActivityThread.access$600(ActivityThread.java:151)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1335)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:155)
      at android.app.ActivityThread.main(ActivityThread.java:5520)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:511)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:796)
      at dalvik.system.NativeStart.main(Native Method)
      Caused by: android.view.InflateException: Binary XML file line #1: Error inflating     class PreferenceScreen
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
      at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
      at     com.soid.client.activities.SignUpPreferenceFragment.onCreateView(SignUpPreferenceFragment.ja    va:18)
      at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:831)
      at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1037)
      at android.app.BackStackRecord.run(BackStackRecord.java:635)
      at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1399)
      at android.app.Activity.performStart(Activity.java:5075)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2328)
      ... 11 more
      Caused by: java.lang.ClassNotFoundException: android.view.PreferenceScreen
      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
      at android.view.LayoutInflater.createView(LayoutInflater.java:552)
      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:643)
      at    com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
      at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
      at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
      ... 20 more
  </code></pre>
  
  <p>Why does it search for the PreferenceScreen in android.view? I'm totally lost, pleas help me out.</p>
  
  <p>Edit:</p>
  
  <p>I forgot to paste the actual PreferenceFragment:</p>
  
  <pre><code>public class SignUpPreferenceFragment extends PreferenceFragment {
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.preferences);
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      return inflater.inflate(R.xml.preferences, container, false);
  </code></pre>
  
  <p>Thank you!</p>