title: Android app keeps crashing with tabhost
body: <p>My goal is to have two tabs created, each with a different activity. I want the tabs to always be visible at the top so I can easily switch between the two. I believe to have everything set up to create two tabs using tabHost, however the app crashes on start up when I run it. </p>
  
  <p>Here is the logcat:</p>
  
  <pre><code>Process: com.example.app, PID: 1321
      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.TabBar}: java.lang.IllegalStateException: Did you forget to call 'public void setup(LocalActivityManager activityGroup)'?
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
              at android.app.ActivityThread.access$800(ActivityThread.java:135)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:136)
              at android.app.ActivityThread.main(ActivityThread.java:5017)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
              at dalvik.system.NativeStart.main(Native Method)
       Caused by: java.lang.IllegalStateException: Did you forget to call 'public void setup(LocalActivityManager activityGroup)'?
              at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:747)
              at android.widget.TabHost.setCurrentTab(TabHost.java:413)
              at android.widget.TabHost.addTab(TabHost.java:240)
              at com.example.app.TabBar.onCreate(TabBar.java:31)
              at android.app.Activity.performCreate(Activity.java:5231)
              at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
              at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
              at android.app.ActivityThread.access$800(ActivityThread.java:135)
              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
              at android.os.Handler.dispatchMessage(Handler.java:102)
              at android.os.Looper.loop(Looper.java:136)
              at android.app.ActivityThread.main(ActivityThread.java:5017)
              at java.lang.reflect.Method.invokeNative(Native Method)
              at java.lang.reflect.Method.invoke(Method.java:515)
              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
              at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Here is my xml for the layout with the tabHost:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TabHost
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@android:id/tabhost"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="fill_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;FrameLayout
              android:id="@android:id/tabcontent"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent" &gt;
  
              &lt;RelativeLayout
                  android:id="@+id/calc"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content" &gt;
              &lt;/RelativeLayout&gt;
  
              &lt;RelativeLayout
                  android:id="@+id/tip"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content" &gt;
              &lt;/RelativeLayout&gt;
          &lt;/FrameLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/TabHost&gt;
  </code></pre>
  
  <p>My code for the main tabBar class:</p>
  
  <pre><code>public class TabLayout extends Activity {
  
      private TabHost mTabHost;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_tab_layout);
          mTabHost = getTabHost();
  
          Intent intent;
          //Creates calculator tab
          intent = new Intent(this, Calculator.class);
          TabHost.TabSpec spec1 = mTabHost.newTabSpec("calc")
                  .setIndicator("CALC")
                  .setContent(intent);
          mTabHost.addTab(spec1);
  
          //Creates tip tab
          intent = new Intent(this, TipCalc.class);
          TabHost.TabSpec spec2 = mTabHost.newTabSpec("tip")
                  .setIndicator("TIP")
                  .setContent(intent);
          mTabHost.addTab(spec2);
      }
  }
  </code></pre>
  
  <p>The manifest file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.calcs"&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/calculators"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.example.calcs.TabLayout"
              android:label="@string/calculators" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;activity android:name="com.example.calcs.Calculator"/&gt;
          &lt;activity android:name="com.example.calcs.TipCalc"/&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>and finally the class for the first tab (2nd tab is pretty much the same):</p>
  
  <pre><code>public class Calculator extends Activity {
  
      @Override
      public void onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_tab_layout);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.tab_layout, menu);
          return true;
      }
  
  }
  </code></pre>
  
  <p>Please help!</p>