Textview visible invisible
Bonjour à vous,
voilà j'essai te faire qu'une textview devienne visible à l'action d'un bouton et qu'elle affiche une variable.
Voici mon code en question :
Code:
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 void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cinema);
//init variable Rescin
int Rescin =0;
//Test Radiobutton 11
RadioButton QR11 = (RadioButton)findViewById(R.id.RQ11);
if (QR11.isChecked()== true){
Rescin = Rescin + 1;
}
//Test Radiobutton 22
RadioButton QR22 = (RadioButton)findViewById(R.id.RQ22);
if (QR22.isChecked() ==true){
Rescin = Rescin + 1;
}
//utilisateur clique sur le buton
Button toto = ((Button)this.findViewById(R.id.toto));
toto.setOnClickListener(new OnClickListener() {
public void onClick(View v){
TextView putre =(TextView)findViewById(R.id.Rcin);
putre.setVisibility(8); //show textview
putre.setText(""+ Rescin + "/3"); //text pour la textview
}
});
} |
Merci pour votre aide