如何把倒数计时器

时间:2013-07-29 10:10:48

标签: android countdowntimer

我有一个有时间限制的问题游戏。我怎么能编码if else =如果他回答正确他会意图进入下一级别,如果他没有在10秒内回答它,他会打算在另一个班级

@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);
        }
    });

}

}     * \

1 个答案:

答案 0 :(得分:1)

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

          }

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

        } 
        }.start();