Android phonegap应用程序在屏幕方向更改时加载第一页
我正在使用phonegap开发一个android应用程序。我在应用程序中有多个页面和一个活动。每当我更改设备的方向时,无论我在哪个页面上,应用程序都会加载应用程序启动时显示的第一个页面。我认为这是因为我没有重写活动中的onResume()方法,但即使这样也无法解决问题 编辑:如果应用程序暂停并恢复,则不会出现此问题 我的活动:Android phonegap应用程序在屏幕方向更改时加载第一页,android,cordova,Android,Cordova,我正在使用phonegap开发一个android应用程序。我在应用程序中有多个页面和一个活动。每当我更改设备的方向时,无论我在哪个页面上,应用程序都会加载应用程序启动时显示的第一个页面。我认为这是因为我没有重写活动中的onResume()方法,但即使这样也无法解决问题 编辑:如果应用程序暂停并恢复,则不会出现此问题 我的活动: public class MainScreen extends DroidGap { @Override public void onCreate(Bun
public class MainScreen extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/landing.html");
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
}
}
编辑:添加了清单文件
我的清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.me.code"
android:versionCode="5"
android:versionName="1.4" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="com.miniorange.authenticator.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.miniorange.authenticator.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.miniorange.authenticator.MainActivity"
android:label="@string/app_name" >
</activity>
<activity android:name="com.miniorange.authenticator.MainScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.plugin.gcm.PushHandlerActivity"/>
<receiver android:name="com.plugin.gcm.CordovaGCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.me.code" />
</intent-filter>
</receiver>
<service android:name="com.plugin.gcm.GCMIntentService" />
</application>
</manifest>
这个问题的解决办法是什么?对不起。。。(迟答:D)
我的应用程序有以下问题:
当我更改方向时,活动将重新加载
我找到了这个解决方案:
将此属性添加到
标记:
android:configChanges="orientation"
建议。。。使用本说明(更好):
==========================================
有关解决方案的信息:
原因是什么。。(?)
它会告诉应用程序,您希望自己处理这些更改(方向、键盘隐藏、键盘、屏幕大小、区域设置等)。您可以发布清单文件吗。
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"