我正在使用我的應用程序,這是代碼。單擊AlertDialog後如何進入下一頁
請點擊AlertDialog中的「確定」按鈕後,請幫助我進入其他頁面的「起始頁面」。
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new CountDownTimer(20000, 1000) {
TextView tv = (TextView) findViewById(R.id.textView1);
public void onTick(long millisUntilEnd) {
tv.setText(String.valueOf(millisUntilEnd/1000));
}
public void onFinish() {
AlertDialog alertDialog1 = new AlertDialog.Builder(
MainActivity.this).create();
// alertDialog1.setTitle("GAMEOVER");
// Setting Dialog Message
alertDialog1.setMessage("Time's Up!");
// Setting Icon to Dialog
// Setting OK Button
alertDialog1.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// Write your code here to execute after dialog
// closed
// Toast.makeText(getApplicationContext(),
//"You clicked on OK", Toast.LENGTH_SHORT).show();
}
});
// Showing Alert Message
alertDialog1.show();
tv.setText("Game Over");
}
}.start();
謝謝..
你是什麼意思的「起始頁」,它是一項活動? –