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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| final EditText te = (EditText)findViewById(R.id.editText1);
final TextView tv = (TextView)findViewById(R.id.textView2);
final TextView tvInterval = (TextView)findViewById(R.id.tvInterval);
Button valider = (Button)findViewById(R.id.valider);
final StringBuffer contenu = new StringBuffer();
valider.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
message = te.getText().toString();
try{
// TODO Auto-generated method stub
int i = Integer.parseInt(message);
if(i < Parametres.random)
{//tv.setText("\n " + i + " est inférieur!\n");
contenu.append( + i + " est inférieur!\n");
tv.setText(contenu);
Toast.makeText(Jouer.this,"vous reste "+j+ " tentatives !",Toast.LENGTH_SHORT).show();
}
else if(i>Parametres.random)
{contenu.append( + i + " est supérieur! \n");
tv.setText(contenu);
Toast.makeText(Jouer.this,"vous reste "+--j+ " tentatives !",Toast.LENGTH_SHORT).show();
}
else
contenu.append(+i +" Wahooooooo");
tv.setText(contenu);
}catch(Exception e){Log.e("mon erreur",e.getMessage());}
te.setText("");
}
}); |
Partager