android:screenOrientation="portrait" not effects on TabGroup at orientation change

You must Login before you can answer or comment on any questions.

I want only portrait orientation in my app. I have read almost all tutorials regarding AndroidManifest.xml, at the end I added the code android:screenOrientation=”portrait” with all activeties in portion of <application> under <manifest> in tiapp.xml which is working perfect for all other activities i.e splash screen etc. except tabgroup, android:screenOrientation=”portrait” or other screen orientation android:screenOrientation=”landscape” not working on tabs with activity "ti.modules.titanium.ui.TiTabActivity" .I tested app on both emulator and actual device but result is still NO. When I rotate device, tab group also change its orientation even orientation is locked by device setting. I also checked AndroidManifest.xml by placing it at Resources/platform/android/ with change of android:screenOrientation=”portrait” .My Titanium not loads AndroidManifest.xml form platform folder, every time built new one so I used code in tiapp.xml. Am I creating mistake at any point on code or its titanium bug.? .js file code is simple as default titanium created with two tabs. an my tiapp.xml looks like this..

<android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
            <application android:icon="@drawable/appicon"
                android:label="Nigerian Stocks" android:name="NigerianStocksApplication"
                android:debuggable="false">
                <activity android:configChanges="keyboard|keyboardHidden|orientation" android:name="com.google.ads.AdActivity"/>
                <activity android:name=".NigerianStocksActivity"
                    android:label="Nigerian Stocks" android:theme="@style/Theme.Titanium"
                    android:configChanges="keyboardHidden|orientation" 
                    android:screenOrientation="portrait">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN" />
                        <category android:name="android.intent.category.LAUNCHER" />
                    </intent-filter>
                </activity>
                <activity android:name="org.appcelerator.titanium.TiActivity"
                    android:configChanges="keyboardHidden|orientation" 
                    android:screenOrientation="portrait"/>
                <activity android:name="org.appcelerator.titanium.TiTranslucentActivity"
                    android:configChanges="keyboardHidden|orientation"
                    android:theme="@android:style/Theme.Translucent"
                    android:screenOrientation="portrait" />
                <activity android:name="org.appcelerator.titanium.TiModalActivity"
                    android:configChanges="keyboardHidden|orientation"
                    android:theme="@android:style/Theme.Translucent"
                    android:screenOrientation="portrait"
                />
                <activity android:name="ti.modules.titanium.ui.TiTabActivity"
                    android:screenOrientation="portrait"
                    android:configChanges="keyboardHidden|orientation" 
                    />
                <activity android:name="ti.modules.titanium.ui.android.TiPreferencesActivity" android:screenOrientation="portrait"/>
 
 
            </application>
        </manifest>
    </android>
need help ??
I’m using ..
1. Mac OS X version: 10.6.8
2. Titanium SDK Version: 1.7.5
3. Android Emulator 2.2 …tested other emulators also

8 Answers

Change this

android:configChanges="keyboardHidden|orientation"
to this
android:configChanges="keyboardHidden"
everywhere in your custom xml where you want to lock the orientation and of course keep the
android:screenOrientation="portrait"
Clean the project and try again. Try also with fastdev disabled.

thanks for replying Dan Tamas!! I have already try this

android:configChanges="keyboardHidden"
still TabGroup is not in control of app..when I perform these changes,clean the build folder and rotate my emulator or device my app turn black and after later shows error The Application abc(process com.companyname.abc) has stopped unexpectedly.Please try again. and App restart.
fastdev also disabled. :-(

try on each window ::

win.orientationModes = [Ti.UI.PORTRAIT];

thanks Gagan Tiwari for reply.I already have tried this on each window.Still Not working.TabGroup not have property orientationModes. and windows are in tabs..

— answered 3 years ago by Usman Mughal
answer permalink
2 Comments
  • so it is must to do some changes in tiapp.xml..................if u need some code then i can post....

    — commented 3 years ago by Gagan Tiwari

  • Hi Gagan Tiwari.I think code will best source for understanding so share the code..

    — commented 3 years ago by Usman Mughal

Hi guy! I'm not getting result of change in activities(android).I reached at point of finding solution of problem "android:screenOrientation="portrait" not effects on TabGroup at orientation change" that adding android:screenOrientation="portrait" in activities only effect on splash screen default by Titanium not effects on any other screen i.e. tabgroup,window etc.Is there any problem in my Titanium?? :(

may be late, but I think you had your custom manifest in wrong location

Resources/platform/android is not where it should be platform directory and resources directory should be siblings

Step by Step to make this thing works!, already tested!.

http://jeanlucdavid.com/2013/01/preserving-android-portrait-orientation-with-tabgroup-using-appcelerator-titanium/

here's my codeblock from tiapp.xml....

<iphone>
        <orientations device="iphone">
            <orientation>Ti.UI.PORTRAIT</orientation>
        </orientations>
        <orientations device="ipad">
            <orientation>Ti.UI.PORTRAIT</orientation>
            <orientation>Ti.UI.UPSIDE_PORTRAIT</orientation>
            <orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
            <orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
        </orientations>
    </iphone>

Your Answer

Think you can help? Login to answer this question!