Home  >  Q&A  >  body text

java - 如何用mediaplayer做一个带进度条,跟有时间显示的播放控件?

问题:进度条已经可以根据音频移动,但是时间无法时时更新,随着音频播放更新时间如何做?

怪我咯怪我咯2742 days ago546

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理2017-04-18 10:58:15

    Use the handler to update the UI. You can add a sleep to the thread, and then get the latest playback time and send a message to the handler every 1 second to update your time progress

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 10:58:15

    Well, it has been solved. This problem, thank you, brother, is to use the handler to continuously send empty messages with an interval of one second, and then update. However, my colleague said that it can also be used in the timer. I have not tried it. Just use it in the timer. It collapsed, I don’t know why

    reply
    0
  • Cancelreply