我想防止我的应用程序在设备的方向更改时重新启动。我已经根据下面的代码锁定了应用程序的方向,但是对于相同的内容没有帮助。应用程序在更改方向时重新启动,即使在锁定后仍然在Android
<activity android:name=".CheckMemory"
android:configChanges="orientation"
android:screenOrientation="portrait"
android:theme="@style/customTheme"
android:label="@string/app_name">
</activity>
和
@Override
public void onConfigurationChanged(final Configuration newConfig) {
super.onConfigurationChanged(newConfig);
//Do nothing here
}
定义“重新启动”。你对这个活动看到了什么行为? logcat输出中是否有任何线索来说明发生了什么? – 2010-06-12 12:08:12
我从链接http://developer.android.com/guide/topics/resources/runtime-changes.html答案从上面的链接 行情 “处理配置改变自己 如果应用程序没有按” t需要在特定的配置更改期间更新资源,并且您有一个性能限制,要求您避免重新启动Activity,然后您可以声明您的Activity处理配置更改本身,从而防止系统重新启动您的活动“ – Maneesh 2010-06-12 12:16:33