1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| public class myActivity extends Activity implements OnClickListener {
private LinearLayout layout1;
private ... layout2;
private ... layout3;
private Button bouton1;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// initialisation des layouts
this.layout1 = new LinearLayout(this);
this.layout2 = ...;
this.layout3 = ...;
this.bouton1 = new Button(this);
this.bouton1.setOnClickListener(this);
layout1.addView(this.btnSend);
setContentView(this.layout1);
}
@Override
public void onClick(View view) {
// TODO Auto-generated method stubNetwork
if (view == this.bouton1){
setContentView(this.layout2);
}
}
} |