Avoiding Application Restart when Hardware Keyboard Opens
Asked Answered
I

1

5

I am currently working on a multi-threaded game application for the Android platform... so far so good... I just got over a bug in my application which caused it to restart on orientation change (fixed by designating a specific orientation depending on the availability of a hardware keyboard or not, which is important 'cuz it is an online game with chat capabilities), and that works... BUT now i am trying to avoid the same problem when the user simply slides open the hardware keyboard. I'm not quite sure how to go about avoiding the restart of my application or the saving of the state of my application. Any solutions/suggestions?

Ionogen answered 7/11, 2010 at 1:19 Comment(0)
C
9

In your <activity> tag in your manifest:

android:configChanges="orientation|keyboardHidden"

In your activity class:

@Override
public void onConfigurationChanged(final Configuration newConfig)
{
    // Ignore orientation change to keep activity from restarting
    super.onConfigurationChanged(newConfig);
}
Cardio answered 7/11, 2010 at 1:23 Comment(1)
beautiful! :D Gotta love an easy solution. Thanks to you I wont be chasing my tail, hah. Good lookin outIonogen

© 2022 - 2024 — McMap. All rights reserved.