Aller au contenu

Problèmes avec plusieurs boutons


hellogoodbye

Recommended Posts

Posté(e)

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.

Hellogoodbye

PS: Je vous joint mon extrait de code:

 
   @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){

		}
	}
     }

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

×
×
  • Créer...