display a countdown timer in the alert dialog box

android, android-alertdialog, timer

Solution

you should have an `alertDialog` for the pop-up box:

alertDialog = new AlertDialog.Builder(this).create();  
alertDialog.setTitle("Alert 3");  
alertDialog.setMessage("00:10");
alertDialog.show();   // 

new CountDownTimer(10000, 1000) {
    @Override
    public void onTick(long millisUntilFinished) {
       alertDialog.setMessage("00:"+ (millisUntilFinished/1000));
    }

    @Override
    public void onFinish() {
        info.setVisibility(View.GONE);
    }
}.start();

Problem

How do i display a countdown timer in my alert box .i want to notify the user that the session will end in 5 minutes and show a timer running in the alert pop up box ..

Original source

Related problems