-1

i have a question game that has time limit. how can i code if else= if he answer it correct he will intent to the next level and if he didnt answer it within 10sec he will be intent in another class

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.easyone);
    a1 = (Button) findViewById(R.id.btn_ea1);
    b1 = (Button) findViewById(R.id.btn_eb1);
    c1 = (Button) findViewById(R.id.btn_ec1);

    a1.setOnClickListener(new View.OnClickListener() {

        @Override   
           public void onClick(View v) {
                Toast.makeText(getApplicationContext(),"CORRECT!",
                        Toast.LENGTH_SHORT).show();
                Intent intent = new Intent(getApplicationContext(),EasyTwo.class);
                startActivity(intent);
        }
    });

}

} *\

DisgruntledGoat
  • 70,219
  • 68
  • 205
  • 290
  • http://stackoverflow.com/questions/17839419/android-thread-for-a-timer/17839725#17839725. check this might help. – Raghunandan Jul 29 '13 at 10:12

1 Answers1

1
         new CountDownTimer(3000, 100) {
         public void onFinish() {

          }

        @Override
        public void onTick(long arg0) {
            // TODO Auto-generated method stub

        } 
        }.start();
KOTIOS
  • 11,177
  • 3
  • 39
  • 66