title: Error inflating class fragment (Tabhost)
body: <p>Here i am implementing an activity to display a tabhost.but i get the error as error inflating binary xml .... i searched this forum for similar answers but none helped me?.
  here is my activity class</p>
  
  <hr>
  
  <pre><code>package com.example.iolcalci;
  
  import android.os.Bundle;
  import android.widget.TabHost;
  import android.widget.TabHost.TabSpec;
  import android.app.Activity;
  
  public class Menu extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_menu);
          TabHost mTab=(TabHost)findViewById(android.R.id.tabhost);
          mTab.setup();
  
          TabSpec specs=mTab.newTabSpec("tag1");
          specs.setContent(R.id.srkt_fragment);
          specs.setIndicator("SRK/T");
          mTab.addTab(specs);
  
          specs=mTab.newTabSpec("tag2");
          specs.setContent(R.id.srk2_fragment);
          specs.setIndicator("SRK II");
          mTab.addTab(specs);
  
          specs=mTab.newTabSpec("tag3");
          specs.setContent(R.id.holl_fragment);
          specs.setIndicator("HOLLADAY");
          mTab.addTab(specs);
  
          specs=mTab.newTabSpec("tag4");
          specs.setContent(R.id.bink_fragment);
          specs.setIndicator("BINKHORST");
          mTab.addTab(specs);
      }
  
  }
  </code></pre>
  
  <hr>
  
  <p>here is my xml code</p>
  
  <hr>
  
  <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="wrap_content"
      android:layout_height="wrap_content" &gt;
  
  &lt;TabHost xmlns:tools="http://schemas.android.com/tools"
      android:id="@android:id/tabhost"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      tools:ignore="HardcodedText" xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="match_parent"
          android:orientation="vertical"&gt;
  
              &lt;TabWidget
                  android:id="@android:id/tabs"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content" &gt;
              &lt;/TabWidget&gt;
  
              &lt;RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="160dp"
                  android:layout_weight="0.05"
                  android:background="@color/Black" &gt;
  
                  &lt;TextView
                      android:id="@+id/al"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignBaseline="@+id/k1"
                      android:layout_alignBottom="@+id/k1"
                      android:layout_alignLeft="@+id/k2"
                      android:text="@string/AL"
                      android:textColor="@color/White"
                      android:textSize="15sp" /&gt;
  
                  &lt;EditText
                      android:id="@+id/al_editText"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignBaseline="@+id/al"
                      android:layout_alignBottom="@+id/al"
                      android:layout_alignLeft="@+id/k2_editText"
                      android:layout_alignRight="@+id/k2_editText"
                      android:background="@drawable/editbg"
                      android:ems="10"
                      android:enabled="true"
                      android:inputType="numberDecimal"
                      android:scrollHorizontally="true"
                      android:singleLine="true"
                      android:textColor="@color/White"
                      android:textSize="15sp"
                      android:visibility="visible"
                      android:width="100dp" /&gt;
  
                  &lt;TextView
                      android:id="@+id/k1"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignParentTop="true"
                      android:layout_marginLeft="46dp"
                      android:layout_marginTop="27dp"
                      android:layout_toRightOf="@+id/al_editText"
                      android:text="@string/K1"
                      android:textColor="@color/white"
                      android:textSize="15sp" /&gt;
  
                  &lt;EditText
                      android:id="@+id/k2_editText"
                      android:layout_width="65dp"
                      android:layout_height="wrap_content"
                      android:layout_alignBaseline="@+id/k2"
                      android:layout_alignBottom="@+id/k2"
                      android:layout_marginLeft="14dp"
                      android:layout_toRightOf="@+id/k2"
                      android:background="@drawable/editbg"
                      android:ems="10"
                      android:enabled="true"
                      android:inputType="numberDecimal"
                      android:scrollHorizontally="true"
                      android:singleLine="true"
                      android:textColor="@color/White"
                      android:textSize="15sp"
                      android:visibility="visible"
                      android:width="100dp" &gt;
  
                      &lt;requestFocus /&gt;
                  &lt;/EditText&gt;
  
                  &lt;TextView
                      android:id="@+id/k2"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignParentLeft="true"
                      android:layout_below="@+id/al_editText"
                      android:layout_marginLeft="16dp"
                      android:layout_marginTop="22dp"
                      android:text="@string/K2"
                      android:textColor="@color/White"
                      android:textSize="15sp" /&gt;
  
                  &lt;TextView
                      android:id="@+id/al_const"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignBottom="@+id/k2_editText"
                      android:layout_alignLeft="@+id/k1"
                      android:text="@string/Rx"
                      android:textColor="@color/White"
                      android:textSize="15sp" /&gt;
  
                  &lt;TextView
                      android:id="@+id/dr"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignLeft="@+id/k2_editText"
                      android:layout_alignParentBottom="true"
                      android:layout_marginBottom="17dp"
                      android:layout_toLeftOf="@+id/k1"
                      android:ems="10"
                      android:gravity="center"
                      android:text="@string/dr"
                      android:textColor="@color/White"
                      android:textSize="15sp" /&gt;
  
                  &lt;EditText
                      android:id="@+id/dr_editText"
                      android:layout_width="65dp"
                      android:layout_height="wrap_content"
                      android:layout_alignBaseline="@+id/dr"
                      android:layout_alignBottom="@+id/dr"
                      android:layout_toRightOf="@+id/dr"
                      android:background="@drawable/editbg"
                      android:ems="10"
                      android:inputType="numberDecimal"
                      android:singleLine="true"
                      android:textColor="@color/White"
                      android:textSize="15sp" /&gt;
  
                  &lt;TextView
                      android:id="@+id/al_metric"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_above="@+id/k2_editText"
                      android:layout_alignTop="@+id/k1"
                      android:layout_toLeftOf="@+id/al_const"
                      android:layout_toRightOf="@+id/al_editText"
                      android:gravity="left|center_vertical"
                      android:text="mm"
                      android:textAppearance="?android:attr/textAppearanceSmall"
                      android:textColor="@color/White" /&gt;
  
                  &lt;EditText
                      android:id="@+id/k1_editText"
                      android:layout_width="65dp"
                      android:layout_height="wrap_content"
                      android:layout_alignBaseline="@+id/k1"
                      android:layout_alignBottom="@+id/k1"
                      android:layout_marginLeft="19dp"
                      android:layout_toRightOf="@+id/k1"
                      android:background="@drawable/editbg"
                      android:ems="10"
                      android:enabled="true"
                      android:inputType="numberDecimal"
                      android:scrollHorizontally="true"
                      android:singleLine="true"
                      android:textColor="@color/White"
                      android:textSize="15sp"
                      android:visibility="visible"
                      android:width="100dp" /&gt;
  
                  &lt;EditText
                      android:id="@+id/al_const_editText"
                      android:layout_width="65dp"
                      android:layout_height="wrap_content"
                      android:layout_alignBaseline="@+id/al_const"
                      android:layout_alignBottom="@+id/al_const"
                      android:layout_toRightOf="@+id/al_const"
                      android:background="@drawable/editbg"
                      android:ems="10"
                      android:enabled="true"
                      android:inputType="numberDecimal"
                      android:scrollHorizontally="true"
                      android:singleLine="true"
                      android:textColor="@color/White"
                      android:textSize="15sp"
                      android:visibility="visible"
                      android:width="100dp" /&gt;
  
                  &lt;EditText
                      android:id="@+id/k1_metric"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignBottom="@+id/al_metric"
                      android:layout_alignTop="@+id/k1"
                      android:layout_toRightOf="@+id/k1_editText"
                      android:gravity="left|top"
                      android:inputType="text"
                      android:textAppearance="?android:attr/textAppearanceSmall"
                      android:textColor="@color/White" /&gt;
  
                  &lt;EditText
                      android:id="@+id/k2_metric"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignBottom="@+id/k2_editText"
                      android:layout_alignTop="@+id/al_const"
                      android:layout_toRightOf="@+id/k2_editText"
                      android:inputType="text"
                      android:textAppearance="?android:attr/textAppearanceSmall"
                      android:textColor="@color/White" /&gt;
  
                  &lt;TextView
                      android:id="@+id/textView1"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignBottom="@+id/dr_editText"
                      android:layout_alignRight="@+id/al_const"
                      android:layout_alignTop="@+id/dr"
                      android:layout_toRightOf="@+id/k1"
                      android:text="D"
                      android:textAppearance="?android:attr/textAppearanceSmall"
                      android:textColor="@color/white" /&gt;
              &lt;/RelativeLayout&gt;
  
              &lt;FrameLayout
              android:id="@android:id/tabcontent"
              android:layout_width="fill_parent"
              android:layout_height="0dip"
              android:layout_weight="1"
              android:background="@color/Black" &gt;
  
              &lt;fragment
                  android:id="@+id/bink_fragment"
                  android:name="com.example.iolcalci.Binkhorst_x"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                   /&gt;
  
              &lt;fragment android:name="com.example.iolcalci.Srkt_x"
                  android:id="@+id/srkt_fragment"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"/&gt;
              &lt;fragment android:name="com.example.iolcalci.Holladay_x"
                  android:id="@+id/holl_fragment"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"/&gt;
              &lt;fragment android:name="com.example.iolcalci.Srk2_x"
                  android:id="@+id/srk2_fragment"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"/&gt;
  
          &lt;/FrameLayout&gt;
  
  
      &lt;/LinearLayout&gt;
  
  &lt;/TabHost&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <hr>
  
  <p>here is my logcat report</p>
  
  <hr>
  
  <pre><code>03-22 18:30:46.869: D/AndroidRuntime(364): Shutting down VM
  03-22 18:30:46.869: W/dalvikvm(364): threadid=1: thread exiting with uncaught exception (group=0x40015560)
  03-22 18:30:46.894: E/AndroidRuntime(364): FATAL EXCEPTION: main
  03-22 18:30:46.894: E/AndroidRuntime(364): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.iolcalci/com.example.iolcalci.Menu}: android.view.InflateException: Binary XML file line #236: Error inflating class fragment
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.os.Handler.dispatchMessage(Handler.java:99)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.os.Looper.loop(Looper.java:123)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.app.ActivityThread.main(ActivityThread.java:3683)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at java.lang.reflect.Method.invokeNative(Native Method)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at java.lang.reflect.Method.invoke(Method.java:507)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at dalvik.system.NativeStart.main(Native Method)
  03-22 18:30:46.894: E/AndroidRuntime(364): Caused by: android.view.InflateException: Binary XML file line #236: Error inflating class fragment
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.app.Activity.setContentView(Activity.java:1657)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at com.example.iolcalci.Menu.onCreate(Menu.java:13)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
  03-22 18:30:46.894: E/AndroidRuntime(364):  ... 11 more
  03-22 18:30:46.894: E/AndroidRuntime(364): Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader dalvik.system.PathClassLoader[/data/app/com.example.iolcalci-2.apk]
  03-22 18:30:46.894: E/AndroidRuntime(364):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.view.LayoutInflater.createView(LayoutInflater.java:471)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
  03-22 18:30:46.894: E/AndroidRuntime(364):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
  03-22 18:30:46.894: E/AndroidRuntime(364):  ... 23 more
  </code></pre>
  
  <hr>
  
  <p>I dont know where the error is as it is not showing the cause in log file. can anyone help me with this please?</p>