title: InflateException error inflating class fragment
body: <p>I keep getting that error when starting the activity that has fragment.</p>
  
  <p>This is the overview of my code:</p>
  
  <p><em>Home</em> activity is started from <em>Splash</em> screen activity</p>
  
  <p><strong>home.xml</strong> (Each fragment has 50% <code>layout_weight</code>)</p>
  
  <pre><code>&lt;LinearLayout&gt;
      &lt;fragment android:name="com.example.test.FragmentClass1" ...&gt;
      &lt;fragment android:name="com.example.test.FragmentClass2" ...&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>fragment1.xml</strong></p>
  
  <pre><code>&lt;LinearLayout&gt;
      //some EditTexts and Buttons here
  &lt;LinearLayout&gt;
  </code></pre>
  
  <p><strong>fragment2.xml</strong></p>
  
  <pre><code>&lt;LinearLayout&gt;
      &lt;ListView ... /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>FragmentClass1.java</strong></p>
  
  <pre><code>public class FragmentClass1 extends Fragment{
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
          View view = inflater.inflate(R.layout.fragment1, container, false);
          return view;
      }
  }
  </code></pre>
  
  <p><strong>FragmentClass2.java</strong></p>
  
  <pre><code>public class FragmentClass2 extends ListFragment{
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
          View view = inflater.inflate(R.layout.fragment2, container, false);
          return view;
      }
  }
  </code></pre>
  
  <p><strong>Home.java</strong></p>
  
  <pre><code>public class Home extends Activity{
      public View onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          setContentView(R.layout.home);
          //still empty
      }
  }
  </code></pre>
  
  <p>The error log is this:</p>
  
  <pre><code>12-09 20:39:00.317: E/AndroidRuntime(18214): FATAL EXCEPTION: main
  12-09 20:39:00.317: E/AndroidRuntime(18214): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.test/com.example.test.Home}: android.view.InflateException: Binary XML file line #10: Error inflating class fragment
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.os.Handler.dispatchMessage(Handler.java:99)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.os.Looper.loop(Looper.java:137)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.ActivityThread.main(ActivityThread.java:5039)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at java.lang.reflect.Method.invokeNative(Native Method)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at java.lang.reflect.Method.invoke(Method.java:511)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at dalvik.system.NativeStart.main(Native Method)
  12-09 20:39:00.317: E/AndroidRuntime(18214): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class fragment
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.Activity.setContentView(Activity.java:1881)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at com.example.test.Home.onCreate(Home.java:16)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.Activity.performCreate(Activity.java:5104)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    ... 11 more
  12-09 20:39:00.317: E/AndroidRuntime(18214): Caused by: java.lang.ClassCastException: com.example.test.Fragment1 cannot be cast to android.app.Fragment
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.Fragment.instantiate(Fragment.java:585)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.Fragment.instantiate(Fragment.java:560)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.app.Activity.onCreateView(Activity.java:4709)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:680)
  12-09 20:39:00.317: E/AndroidRuntime(18214):    ... 21 more
  </code></pre>
  
  <p>Any solution? Thanks</p>