我在这行代码中不断收到此错误,无法找出根本原因
closedialog.show();
我尝试过试一试/但是错误仍然存在。
Runnable runnable = new Runnable() {
@Override
public void run() {
handler.post(new Runnable() { // This thread runs in the UI
@Override
public void run() {
try{
AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this);
alert.setTitle("Message");
alert.setMessage(alertMessage);
alert.setIcon(R.drawable.recharge_icon);
//alert.show();
final AlertDialog closedialog= alert.create();
closedialog.show();
final Timer timer2 = new Timer();
timer2.schedule(new TimerTask() {
public void run() {
closedialog.dismiss();
timer2.cancel(); //this will cancel the timer of the system
}
}, 8000); // the timer will count 5 seconds....
}catch(Exception ex){
ex.printStackTrace();
}
}
});
}
};
new Thread(runnable).start();
return
请问可能出错?