i am iPhone programmer and new in android development , I developed a tab host based application. Can I switch between activites as I was doing in iphone [self.navigationController pushViewController: and [self.navigationController popViewControllerAnimated: is there any way o开发者_如何学JAVAf doing this like of thing in android? Please help
Create two xml layouts and write ur necessary codings there.Now create a new activity and for tabhost and add the tabs u need and u need to include the two xml layouts in tab host
public class UserCreation extends TabActivity {
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_creation);
Resources ressources = getResources();
TabHost tabhost=getTabHost();
Intent createUserIntent=new Intent().setClass(this, UserCreationFragment.class);
TabSpec tabspecUserCreation= tabhost.newTabSpec("Create user")
.setIndicator("", ressources.getDrawable(R.drawable.insert_user)).setContent(createUserIntent);
Intent deleteUserIntent=new Intent().setClass(this, Deleteuser.class);
TabSpec tabspecuserDeletion=tabhost.newTabSpec("Delete user").setIndicator("", ressources.getDrawable(R.drawable.del_user))
.setContent(deleteUserIntent);
tabhost.addTab(tabspecUserCreation);
tabhost.addTab(tabspecuserDeletion);
}
}
refer the following example for better reference
Android Tabhost
精彩评论