0

When orientation changes in landscape mode, start a new activity. After back to this activity when orientation in portrait mode in Android.

ЯegDwight
  • 24,315
  • 10
  • 44
  • 52
ashish
  • 15
  • 1
  • 3
  • 1
    Your question is not clear. Can you rephrase? – Michael Petrotta Jan 18 '11 at 05:04
  • Clearly explain how to trigger screen orientation was add here: http://stackoverflow.com/questions/2795833/check-orientation-on-android-phone/5072754#5072754 – NguyenDat Feb 22 '11 at 00:18
  • I think he is asking "I have an app. When the orientation changes, it recreates the Activity in landscape mode. After I'm through with this activity, I hit the "back" key, and I get back to the earlier activity which was in portrait mode. What gives with this?" – Peter vdL Feb 17 '12 at 01:56

3 Answers3

1

Yes this the default behavior of any activity. If you want to stop this you can
- Set the activity asandroid:configChanges="orientation" Then Override the onConfigurationChanged like this

@Override
    public void onConfigurationChanged(Configuration newConfig) {
      super.onConfigurationChanged(newConfig);

    }

If you want to react to the changes refer this
Faster Screen Orientation Change,
Retaining an Object During a Configuration Change

Labeeb Panampullan
  • 33,641
  • 28
  • 92
  • 112
  • 1
    This should only be used in special cases. If your app breaks when it needs to get restarted like this, making this change will not fix the problem but just avoid it happening in this one case. Users *can* and *will* see your app fail in other cases, and it will be much harder to track down the problem and test it because you are hiding it. You *must* write your application correctly to handle it being restarted. – hackbod Jan 18 '11 at 05:46
1

In the Android Manifest file xml for your app place this code in there in the activity for the forms that you want. Each form will have its own activity and you can specify which ones that you want to have as landscape. Find the name for the activity listed ".name"

 <activity android:name=".name"
              android:label="@string/app_name"
              android:screenOrientation="landscape">
        <intent-filter>

The real key to this is make sure you specify screenOrientation="landscape"
this overrides the auto rotate sensor and it will not work for that screen.

mr.j05hua
  • 180
  • 4
  • 14
0

I think that you can set only one orientation in your app so that you cannot change orientation like written in this Q&A

Community
  • 1
  • 1
Eclipses
  • 1,008
  • 1
  • 9
  • 17