c0dehunter
c0dehunter

Reputation: 6160

Android: service binding lost when orientation changes

I have a music player activity with a service which plays the music. When the screen orientation changes I loose the binding with the service and therefore I can't stop it. I can see this because "Play" button which previoulsy had stop icon has again play icon - so the interface kinda resets.

How to solve this?

Upvotes: 0

Views: 3132

Answers (1)

FoamyGuy
FoamyGuy

Reputation: 46856

check out this question: How to handle an AsyncTask during Screen Rotation?

try the accepted answer that is there. (If it works for you vote it up there, not me.)

If your specific application requires that you need to do some work when the rotation happens then you'll have to also override the onConfigurationChanged() inside your activity and put whatever work you need to do there.

Upvotes: 1

Related Questions