嗨,在我的 android 应用程序中,我正在使用 videoview。我想启动一个计时器并在 30 分钟后停止播放器。我尝试使用以下代码,但在到达时间之前显示警报。
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);
实时是我希望执行对话的时间。
并在播放器的准备好的监听器中调用它。
如果我需要更改任何内容,请告诉我。
请转发您的宝贵建议。
提前致谢 :)