Reputation:
i am developing a game in which i have to use both landscape mode for my game scene.
but when i change orientation
my game restart and load from splash screen how to stop this.
could any one please help me.
i am using
final EngineOptions eo = new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR,
new FillResolutionPolicy(), _camera);
Upvotes: 1
Views: 742
Reputation: 1918
add screenOrientation tag in your GameActivity in AndroidManifest.xml
<activity
android:name=".YourgameActivity"
android:screenOrientation="landscape" >
</activity>
Upvotes: 0
Reputation: 133560
http://developer.android.com/guide/topics/resources/runtime-changes.html. Please check the documentation under the heading Handling the Configuration Change Yourself.
<activity android:name=".Activity_name"
android:configChanges="orientation|keyboardHidden|screenSize">
Screen size to be added for 3.2 and above.
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if(newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE){
//do something
}
else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
//do something
}
}
I assume you have a splash screen and after displaying splash screen navigates to activity called Main. In this case your splash screen should run only once when the app is started. You have to call finish() before navigating to next activity. Splash Screen gets destroyed and you navigate to next screen.
Upvotes: 3
Reputation: 1803
add following in your manifest file in your activity tag
android:ConfigChanges="keyboardHidden|orientation|screensize"
Upvotes: 0