ghostrider
ghostrider

Reputation: 5259

Screen Orientation changes my running activity

I have an app in which when I press a Button, another screen is showed. I have added the classes for other screen, and also edited the manifest file and my problem is this: When I am on the other screen (not my initial one) and I turn me mobile screen (change the orientation) my app goes to the main screen, just like I have pressed the back button (or just like pressing the Home button that there is on my screen2). If you need any code, tell me and I will edit my post.

Upvotes: 1

Views: 163

Answers (2)

mseo
mseo

Reputation: 3911

Not the best, but maybe the easiest solution is to add

android:configChanges="keyboardHidden|orientation" 

to every activity in your manifest so it looks like

<activity android:name="com.your.activity"
          android:configChanges="keyboardHidden|orientation"/>

Upvotes: 1

neciu
neciu

Reputation: 4495

Looks that you have messed with Activity stack. Keep in mind that every time you change orientation of your app the onCreate method is fired.

And of course your code is essential.

Upvotes: 4

Related Questions