Going back to the parent activity and load another activity in Android
<p>I am having one main activity which has two tabs. On clicking the tabs it shows the different activity on the same tab.
Now I want suppose I had clicked on first tab and it shows 2 buttons. onClick of one of the button a Alert box opens having two lists. Now What I want is on clicking on one of the list the Activity which is shown in Tab 1 should be changed to another Activity.</p>

<p>I have tried but it didn't Work.</p>

<p>Here is the Code for main Activity:</p>

<pre><code>package com.example.admonitio;

import android.os.Bundle;
import android.app.TabActivity;
import android.content.Intent;
import android.view.Menu;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

@SuppressWarnings("deprecation") public class MainActivity extends TabActivity {
TabHost tabHost;
TabSpec spec1;
TabSpec spec2;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    tabHost=getTabHost();
    spec1=tabHost.newTabSpec("Tab 1");
    spec2=tabHost.newTabSpec("Tab 2");
    //tabHost.setup();


    Intent tabIntent1 = new Intent(MainActivity.this, AddNewReminder.class );
    spec1.setContent(tabIntent1);
    //spec1.setContent(R.id.tab1);
    spec1.setIndicator("Add new reminder");


    Intent tabIntent2 = new Intent(MainActivity.this, GoogleMaps.class );
    spec2.setContent(tabIntent2);
    spec2.setIndicator("Existing reminders");
    //spec2.setContent(R.id.tab2);


    tabHost.addTab(spec1);
    tabHost.addTab(spec2);
}
public void viewOneClick(){
    Intent tabIntent1 = new Intent(this, GoogleMaps.class);
    spec1.setContent(tabIntent1);
    spec1.setIndicator("Add new reminder");


}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

}
</code></pre>

<p>Here is the Code for AddNewReminder:</p>

<pre><code>package com.example.admonitio;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.GridLayout.Spec;

public class AddNewReminder extends Activity implements OnClickListener {

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add_new_reminder);

    Button onLeave = (Button) findViewById(R.id.button1);
    onLeave.setOnClickListener(this);
}
@Override
public void onClick(View v) {
    // TODO Auto-generated method stub
    if (v.getId() == R.id.button1) {
        AlertDialog.Builder alert = new AlertDialog.Builder(this);
        alert.setTitle("Pick any one");
        String[] x = {"On Current Location", "On NewLocation"};
        alert.setItems(x, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
                if(which == 0){
                    //I WANT TO WRITE SOME CODE HERE
                                            // SO THAT OTHER ACTIVITY SHOULD BE
                                            //LOADED IN REPLACE OF AddNewReminder
                                            //ACTIVITY WHICH IS IN TAB1 OF MAIN
                                             //ACTIVITY.
                }               
            }
        });
        alert.show();
    }
    else if (v.getId() == R.id.button2) {

    }
}
}
</code></pre>

<p>And there is a GoogleMaps activity.</p>

<p>Now onClick event of the "On Current Location", GoogleMap Activity should open in the place of AddNewReminder Activity which is inside tab1 of main Activity.</p>
