How to make a function that returns after it is finished playing audio?
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
精彩评论