android - Alertdialog automatically do action after timer -
i trying create alertdialog gives user yes or no choice if neither button pressed in timeframe deafult action occurs. wondering if possible
sure, possible, recommend display timer not let user poker face when dialog gets closed no interaction.
here steps follow:
- to create dialog use
dialogfragment
this tutorial create one. - to start timer , callback calls when time ticking, use
countdowntimer
, in doc have example. - finally when time finished make call
dialogfragment#dismiss()
close dialog no user interaction.
remember cancel timer if user interacts dialog, avoid leaking resources.
Comments
Post a Comment