Reputation: 4024
Currently I am working on audio streaming on android. All method I have written related to streaming and playing the audio is in the onCreate() method. The problem is when ever I change into portrait mode, all methods are called again. How can I prevent this?
Upvotes: 1
Views: 267
Reputation: 80340
When orientation is changed currently active Activity is destroyed and a new one is created.
Either you could prevent orientation change with android:configChanges="orientation|keyboardHidden"
or move audio streaming code to a Service.
Upvotes: 1
Reputation: 22930
You need to android:configChanges="orientation"
this on your Manifest to your activity. That will stop it from calling Oncreate again.
Upvotes: 1