title: Android app , Launching a tabActivity from menu Item
body: <p>I am trying to launch a <code>tabActivity</code> from the menu pane of my main  <code>activity</code> (i mean the one that loads on startup).</p>
  
  <p>Although the app compiles fine , and even runs, as soon as I press the menu button then the relevant icon for the <code>tabActivity</code> there is a runtime error:</p>
  
  <pre><code>$ 04-10 03:00:50.374: E/AndroidRuntime(6531): FATAL EXCEPTION: main
  04-10 03:00:50.374: E/AndroidRuntime(6531): java.lang.RuntimeException: Unable to start activity ComponentInfo{Impek.Gen/Impek.Gen.Impekcals}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2753)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at android.app.ActivityThread.access$2500(ActivityThread.java:129)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2117)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at android.os.Handler.dispatchMessage(Handler.java:99)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at android.os.Looper.loop(Looper.java:143)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at android.app.ActivityThread.main(ActivityThread.java:4717)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at java.lang.reflect.Method.invokeNative(Native Method)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at java.lang.reflect.Method.invoke(Method.java:521)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at dalvik.system.NativeStart.main(Native Method)
  04-10 03:00:50.374: E/AndroidRuntime(6531): Caused by: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at android.app.TabActivity.onContentChanged(TabActivity.java:105)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:229)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at android.app.Activity.setContentView(Activity.java:1677)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at Impek.Gen.Impekcals.onCreate(Impekcals.java:34)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
  04-10 03:00:50.374: E/AndroidRuntime(6531):     ... 11 more
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>     $  main activitys oncreate and menu functions
       public class ImpekActivity extends Activity {
  /** Called when the activity is first created. */
  private Planner p;
  public static Context curr;
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      curr = this;
      GeoLocation.setup_GeoLocation();
      p = new Planner(curr);
      update();
      //p.addNewEntry("", latitude, longitude, arrival, postcode)
  } 
  
          @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle item selection
      switch (item.getItemId()) {
          case R.id.item2:
              Intent f = new Intent(curr, Impeksettings.class);
              startActivity(f);
              return true;
          case R.id.item1:
              Intent t = new Intent(curr,Impekadd.class);
              startActivity(t);
              return true;
          case R.id.calendars:
              Intent c = new Intent(curr,Impekcals.class);
              startActivity(c);
              return true;
          default:
              return super.onOptionsItemSelected(item);
      }
  }
  
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.mainmenu, menu);
      return true;
  }`
  </code></pre>
  
  <p>This tab activity is called on press:</p>
  
  <pre><code>public class Impekcals extends TabActivity{
  
      public void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.calendars);
  
              Resources res = getResources(); // Resource object to get Drawables
              TabHost tabHost = getTabHost();  // The activity TabHost
              TabHost.TabSpec spec;  // Resusable TabSpec for each tab
              Intent intent;  // Reusable Intent for each tab
  
              // Create an Intent to launch an Activity for the tab (to be reused)
              intent = new Intent().setClass(this, GlobalCal.class);
  
              // Initialize a TabSpec for each tab and add it to the TabHost
              spec = tabHost.newTabSpec("global").setIndicator("Global",
                                res.getDrawable(R.drawable.globalcal))
                            .setContent(intent);
              tabHost.addTab(spec);
  
              // Do the same for the other tabs
              intent = new Intent().setClass(this, GoogleCal.class);
              spec = tabHost.newTabSpec("Googlecal").setIndicator("Google",
                                res.getDrawable(R.drawable.googlecal))
                            .setContent(intent);
              tabHost.addTab(spec);
  
              intent = new Intent().setClass(this, LocalCal.class);
              spec = tabHost.newTabSpec("Local").setIndicator("Local",
                                res.getDrawable(R.drawable.localcal))
                            .setContent(intent);
              tabHost.addTab(spec);
  
  
              intent = new Intent().setClass(this, SearchEvent.class);
              spec = tabHost.newTabSpec("search").setIndicator("Search",
                                res.getDrawable(R.drawable.searchcal))
                            .setContent(intent);
              tabHost.addTab(spec);
  
       tabHost.setCurrentTab(1);
  
      }
  
  
  
  }
  
  
  
  
      `
  </code></pre>
  
  <p>Any help appreciated :D</p>