我有以下代码:
public class P1R1 extends Activity {
int correctCounter;
private String[] answerString;
private TextView score;
private static final Random rgenerator = new Random();
protected static final String EXTRA_playerOneScore = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.level);
score = (TextView) findViewById(R.id.score);
correctCounter = 0;
loadActivity();
//start round timer
new CountDownTimer(60000, 1000) {
final TextView timer = (TextView) findViewById(R.id.timer);
public void onTick(long millisUntilFinished) {
timer.setText("Time: " + millisUntilFinished / 1000 + "s");
}
public void onFinish() {
Intent roundOneToTwo = new Intent(getActivity(), R1R2.class);
String playerOneScore = String.valueOf(correctCounter);
roundOneToTwo.putExtra(EXTRA_playerOneScore, playerOneScore);
startActivity(roundOneToTwo);
}
}.start();
我有一个计时器正在运行,当计时器结束时,我希望它Intent
运行,但我的 Intent 语句出现错误The constructor Intent(new CountDownTimer(){}, Class<R1R2>) is undefined
。
我确实创建了一个 R1R2 类,但我的 Intent 仍然出错。我还是android的新手,所以如果你能提供帮助那就太好了。谢谢!