3

How do i get a slash screen default mode set to landscape in Titanium. In my app i tried

Titanium.UI.orientation = Titanium.UI.LANDSCAPE_LEFT;
var NavigationController = require('NavigationController').NavigationController;
var windows = require('window_js').windows;

and in window_js.js its

exports.windows = function(navController){
 var window = Ti.UI.createWindow({
    backgroundColor : '#fff',
    navBarHidden : true,
    fullscreen:true
 });
   return window;
};

But this code shows an error Wrapped java.lang.RuntimeException: java.lang.NullPointerException (file:///android_asset/Resources/app.js#1)

and afterremovinf line 1 i.e.

Titanium.UI.orientation = Titanium.UI.LANDSCAPE_LEFT;

App starts in portrait mode and splash screen quickly changes to the landscape mode. What is the possible solution for this ? Thanks.

Sahil Grover
  • 1,862
  • 4
  • 26
  • 57

2 Answers2

1

Splash screen in landscape mode is goto android project folder

Project ---> Build ---- > Android ------> AndroidManifest.xml file .

Copy AndroidMenifest.xml file text and put in AndroidManifest.custom.xml file in same folder where AndroidManifest.xml file is kept.

In activity tag write

android:screenOrientation="landscape" for landscape mode 

and replace

   android:configChanges="keyboardHidden|orientation" 

to

  android:configChanges="keyboardHidden" 

in whole file in each activity . Example

<activity>
android:configChanges="keyboardHidden"
android:screenOrientation="landscape"
</activity>

This worked for me :)

Sahil Grover
  • 1,862
  • 4
  • 26
  • 57
0

i would try to set the landscape orientation in the android manifest xml /tiapp.xml like here:

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

and then i would change the orientation in your js back to portrait.

Titanium.UI.orientation = Titanium.UI.PORTRAIT;
Community
  • 1
  • 1
mkind
  • 2,015
  • 2
  • 20
  • 25