[英]Avoiding Application Restart when Hardware Keyboard Opens
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. 我目前正在为Android平台开发一个多线程游戏应用程序...到目前为止一切都很好......我刚刚在我的应用程序中遇到了一个错误,导致它在方向更改时重新启动(通过指定具体的方向来修复)关于硬件键盘的可用性与否,这是重要的“因为它是一个具有聊天功能的在线游戏”,并且有效......但是现在我试图避免在用户只需滑动打开硬件键盘时出现同样的问题。 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?
任何解决方案/建议?
In your <activity>
tag in your manifest: 在清单中的
<activity>
标记中:
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);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.