Put a boolean flag in there and you'll have to handle it yourself in some 
way

On Monday, December 24, 2012 5:16:52 AM UTC-6, Tamás Kovács wrote:
>
> The official documentation about pause(): 
>
> pause() 
> Valid states: {Started, Paused} 
> Invalid states: {Idle, Initialized, Prepared, Stopped, 
> PlaybackCompleted, Error} 
> "Calling this method in an invalid state transfers the object to the 
> Error state." 
>
> How can I be safe when doing this: 
>
> if (mediaplayer.isPlaying()) { 
>     mediaplayer.pause() 
>
> } 
>
> The player might enter PlaybackCompleted between calling isPlaying() 
> and pause(), i.e. pause() is still called. This is a race condition. 
> (The playbackcomplete listener doesn't help anything on this.) 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to