Problèmes avec plusieurs boutons
Salut,
j'ai un soucis, je souhaiterai mettre plusieurs boutons dans un même code java/android et je ne comprends pas pourquoi cela ne fonctionne pas, ou plutôt cela fonctionne pour le premier mais pas pour le second. Pour le second, cela me dit: "void is an invalid type for the variable onClick". Je ne comprends pas car c'est un type valide pour le premier bouton.
Merci de votre aide.
PS: Je vous joint mon extrait de code:
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
|
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home_screen);
Click = (Button)findViewById(R.id.click);
Name = (EditText)findViewById(R.id.name);
Click.setOnClickListener(this);
}
@Override
public void onClick(View vClick) {
if (vClick == Click && !Name.getText().toString().equals("") && !Name.getText().toString().equals("teacher")) {
setContentView(R.layout.explications);
LetsPlay = (Button)findViewById(R.id.letsplay);
LetsPlay.setOnClickListener(this);
@Override
public void onClick(View vLetsPlay){
}
}
} |