final Handler handler = new Handler();
Runnable runnable = new Runnable() {
    public void run() {
        int duration = mVideoView.getCurrentPosition();
        if(mVideoView.isPlaying()){
            if (old_duration == duration) {
                mProgressBar.setVisibility(View.VISIBLE);
            } else {
                mProgressBar.setVisibility(View.GONE);
            }
        }
        old_duration = duration;
        handler.postDelayed(runnable, 500);
    }
};
handler.postDelayed(runnable, 0);

 

//关闭activity时销毁检测线程
@Override
protected void onDestroy() { handler.removeCallbacks(runnable); super.onDestroy(); }

 

相关文章:

  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
猜你喜欢
  • 2021-10-06
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
  • 2021-06-03
相关资源
相似解决方案