This is how i did it
private void onBackPressed(){
RootActivity parentActivity;
parentActivity = (RootActivity) this.getParent();
parentActivity.switchToSecondActivity();
} // here RootActivity is the tabhost
in RootActivity
public void switchToSecondActivity(){
tabHost.setCurrentTab(SECOND);
} //SECOND is an integer pointing location of the second activity. it starts from 0