Reputation: 11
I have alert dialog box having two button a. OK b. No
If user press ok some operation is performed else some other action is performed .
What I am looking for is that to check if user has entered any button or not if he has not, After few second I wish to send some message. Would any one help me with this ??
Upvotes: 0
Views: 120
Reputation: 1077
You can use a Timer after your AlertDialog.show()
method.
yourDialog.show();
final Timer timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
if (yourDialog.isShowing()) {
// Send some message
timer.cancel();
}
}
}, 2000); // Seconds in milliseconds
Also check this question for other possibilities: Android close dialog after 5 seconds?
Upvotes: 1