Je reçois des erreurs de support Je ne peux pas comprendre.erreurs de support Android
le code devrait avoir un nombre aléatoire après un bouton est poussé, alors je devrais avoir un compteur qui compte en dessous de cela. mon objectif à la fin est d'avoir une condition de victoire qui vérifie si les chiffres sont les mêmes et que vous gagnez. Mais juste besoin d'aide pour aligner ces parenthèses. ce faisant dans Eclipse pour android toute aide serait génial merci!
package com.viralgamez.gastime;
import java.util.Random;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class NewGame<Stopwatch> extends Activity {
private TextView displayRandInt;
private Button updateRandInt;
final int MSG_START_TIMER = 0;
final int MSG_STOP_TIMER = 1;
final int MSG_UPDATE_TIMER = 2;
private static final Random rand = new Random();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.newgame);
/* Setup your Activity */
// Find the views (their id's should be specified in the XML layout file)
displayRandInt = (TextView) findViewById(R.id.displayRandInt);
updateRandInt = (Button) findViewById(R.id.updateRandInt);
// Give the Button an onClickListener
updateRandInt.setOnClickListener(new android.view.View.OnClickListener() {
public void onClick(View v) {
int randInt = rand.nextInt(100)+1;
displayRandInt.setText(String.valueOf(randInt));
}
public void onClick2(View v) {
if(status == false)
{
btnStart.setText("Stop");
status = true;
new Thread(new Runnable()
{ run(){
for(int i=0; i < 500; i++)
{
runOnUiThread(new Runnable()
{
@Override
public void run()
{
txtCounter.setText(String.valueOf(i));
}
});
Thread.sleep(1000);
}}
}).start();
}
else if (status == true)
{
btnStart.setText("Start");
status = false;
initCouner();
});
Vous ne savez pas quelle est la question; l'utilisation d'indentation cohérente aiderait beaucoup. –
Quelle est l'erreur exacte que vous obtenez? –
marqueurs multiples à cette ligne \t - Erreur de syntaxe, insérer "}" pour terminer ClassBody \t - Erreur de syntaxe, insérer "else" pour terminer \t IfStatement \t - Erreur de syntaxe, insérer "}" pour terminer MethodBody \t - erreur de syntaxe, insérer "}" pour terminer MethodBody – Dexter1088