Pages

Friday, June 6, 2014

Inner Tab Android

public class first extends ActivityGroup{


Button launchButton;
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity1);


launchButton = (Button)findViewById(R.id.button1);
launchButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
Intent activity3Intent = new Intent(v.getContext(), second.class);

replaceContentView("activity3", activity3Intent);
}
});
}
public void replaceContentView(String id, Intent newIntent) {
View view = getLocalActivityManager().startActivity(id,newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView(); this.setContentView(view);
}  
}





For Next Class

@Override
public void onClick(View v) {
// TODO Auto-generated method stub

Intent activity4Intent = new Intent(v.getContext(), third.class);
//StringBuffer urlString = new StringBuffer();
first parentActivity = (first)getParent();
parentActivity.replaceContentView("activity4", activity4Intent);

}

No comments:

Post a Comment