Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get landscape view for splash screen in Android using Titanium?

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.

like image 662
Sahil Grover Avatar asked Jan 22 '26 10:01

Sahil Grover


1 Answers

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 :)

like image 169
Sahil Grover Avatar answered Jan 25 '26 01:01

Sahil Grover



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!