title: Adding an intent to a TabActivity in Android
body: <p>I checked up some online tutorials on how to build a TAB in android and saw a tutorial that fit my requirements. I was happy to implement it and it worked well. The problem came when I wanted each separate tab to push to one separate activity. I couldn't start and intent to pass on the control. I've given only the main code as to how I am making the Tab's as the xml required for the construction does not have any functionality in this question.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>public class Secondactivity extends TabActivity {
  private TabHost mTabHost;
  private void setupTabHost() {
  mTabHost = (TabHost) findViewById(android.R.id.tabhost);
  mTabHost.setup();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
  setupTabHost();
      mTabHost.getTabWidget().setDividerDrawable(se.copernicus.activity.R.drawable.tab_divider);
  
      setupTab(new TextView(this), "Month");
      setupTab(new TextView(this), "Week");
      setupTab(new TextView(this), "Day");
  }
  private void setupTab(final View view, final String tag) {
  View tabview = createTabView(mTabHost.getContext(), tag);
  
  TabSpec setContent = mTabHost.newTabSpec(tag).setIndicator(tabview)
          .setContent(new TabContentFactory() {
              public View createTabContent(String tag) {
                  return view;
              }
          });
  mTabHost.addTab(setContent);
  
  }
  
  private static View createTabView(final Context context, final String text) {
  View view = LayoutInflater.from(context)
          .inflate(R.layout.tabs_bg, null);
  TextView tv = (TextView) view.findViewById(R.id.tabsText);
  tv.setText(text);
  return view;
     }
  }
  </code></pre>
  
  <p>How can I start a new Intent so that when the Tab is clicked it should go from <code>Secondactivity</code> to <code>WeekActivity</code> or <code>DayActivity</code> ?</p>