title: Android. How to change Activity within a Tab
body: <p>Following situation:
  I have TabActivity with e.g. three tabs, TabA, TabB, TabC.</p>
  
  <p>There are a button in activity (Act_C_1) of TabC. So if the user clicks on that button, another activity (Act_C_2) should occur in TabC.</p>
  
  <p>I thank you in advance for any suggestions / or ideas.</p>
  
  <p>Mur</p>
  
  <p><strong>UPD:</strong></p>
  
  <p>Here is my code</p>
  
  <p>TabActivity with three Activities:</p>
  
  <pre><code>public class TabScreen extends TabActivity
  {
      public void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
  
          setContentView(R.layout.tab_menu);
  
          TabHost tabHost = getTabHost();  // The activity TabHost
          TabHost.TabSpec spec;  // Resusable TabSpec for each tab
          Intent intent;  // Reusable Intent for each tab
  
          intent = new Intent().setClass(this, SecondActivity.class);
  
          // Initialize a TabSpec for each tab and add it to the TabHost
          spec = tabHost.newTabSpec("tab_1").setIndicator("Tab1",null).setContent(intent);
          tabHost.addTab(spec);
  
          intent = new Intent().setClass(this, ThirdActivity.class);
          // Initialize a TabSpec for each tab and add it to the TabHost
          spec = tabHost.newTabSpec("tab_2").setIndicator("Tab2",null).setContent(intent);
          tabHost.addTab(spec);
  
          intent = new Intent().setClass(this, FourthActivity.class);
          spec = tabHost.newTabSpec("tab_3").setIndicator("Tab3",null).setContent(intent);
          tabHost.addTab(spec);
      }
  
  }
  </code></pre>
  
  <p>Activity 'Act_C_1' or FourthActivity.java:</p>
  
  <pre><code>public class FourthActivity extends Activity implements OnClickListener
  {
      public void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.fourth);
  
          Button BtnWeiter = (Button)findViewById(R.id.BtnWeiter);
          BtnWeiter.setOnClickListener(this);
      }
  
      @Override
      public void onClick(View v) 
      {                    
          // I also tried to use LocalActivityManager
          // TabActivity parentTabActivity = (TabActivity) getParent();            
          // LocalActivityManager manager = parentTabActivity.getLocalActivityManager();
          // manager.destroyActivity("tab_3", true);
          // manager.startActivity("tab_3", new Intent(this, FourthActivity.class));
          finish();
          startActivity(new Intent(this, FourthActivity.class));            
      }        
  }
  </code></pre>