开发者

How to make a function that returns after it is finished playing audio?

开发者 https://www.devze.com 2023-03-29 00:49 出处:网络
I want to have a method that plays a specific audio fi开发者_运维百科le and only returns when it is finished playing.You shouldn\'t, it will block a thread and you\'ll kill CPU for nothing.

I want to have a method that plays a specific audio fi开发者_运维百科le and only returns when it is finished playing.


You shouldn't, it will block a thread and you'll kill CPU for nothing.

Use this: http://developer.android.com/reference/android/media/MediaPlayer.OnCompletionListener.html

Here for how to use it: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/media/MediaPlayerDemo_Video.html

0

精彩评论

暂无评论...
验证码 换一张
取 消