我有一个有时间限制的问题游戏。我怎么能编码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);
}
});
}
} * \
答案 0 :(得分:1)
new CountDownTimer(3000, 100) {
public void onFinish() {
}
@Override
public void onTick(long arg0) {
// TODO Auto-generated method stub
}
}.start();