Hi
In my android application i am using videoview.
I would like to start a timer and stop the player after 30 minutes.
I tried using the below code but the alert is displaying before the time is reached.
public final void timerAlert() {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
mVideoView.pause();
Alerts.ShowAlert("Cannot play",
"Subscribed time has been completed", context);
}
}, realtime);
Where realtime is the time after which i want the dialogue to be executed.
And am calling this in onprepared listener of player.
Please let me know if i require to change anything.
Please forward your valuable suggestions.
Thanks in advance 🙂
First you create handler , processe Message : apply your logic here..
use handler to send delayed message after 30Minutes. ( See Comment)
Thanks 🙂