Android Launcher应用程序不断被破坏
我正在开发包含WebView的自定义启动程序应用程序。当我以普通应用程序的形式启动应用程序时,在调用startActivity()/startActivityForResult()后(Intent.ACTION_调用,在使用Intent for MediaStore.ACTION_IMAGE_CAPTURE时不会发生)应用程序调用Pause()、onStop()和其他活动,在完成任务后会返回到应用程序。然而,当我将应用程序设置为启动器时,它会在onPause()和onStop()之后调用onDestroy()。这样的行为是不可取的,因为我试图在launcher WebView应用程序中保留插入的数据 在onDestroy()之后的logcat中也有许多错误,与E/libGLESv2类似或相同﹕ HWUI保护:从应用程序上下文F:ES3 glDeleteBuffers调用错误(当不将其用作启动器时,会出现此类错误,但偶尔会出现,并且会在不同的情况下出现) 应用程序清单包含Android Launcher应用程序不断被破坏,android,android-webview,launcher,Android,Android Webview,Launcher,我正在开发包含WebView的自定义启动程序应用程序。当我以普通应用程序的形式启动应用程序时,在调用startActivity()/startActivityForResult()后(Intent.ACTION_调用,在使用Intent for MediaStore.ACTION_IMAGE_CAPTURE时不会发生)应用程序调用Pause()、onStop()和其他活动,在完成任务后会返回到应用程序。然而,当我将应用程序设置为启动器时,它会在onPause()和onStop()之后调用onDe
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleTask" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
我还尝试使用singleInstance,在这种模式下,应用程序在安装后可以正常工作,但在重新启动后会破坏其行为
使用在安卓4.4.2上测试过的MinsdkVersion19。让我们先把它改成这样
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
好的,下面是我如何解决这个问题的,以及问题的实质。我曾经
Settings.System.putInt(
getContentResolver(),
Settings.System.USER_ROTATION,
// toRotate //Or a different ROTATION_ constant
Surface.ROTATION_270
);
对于屏幕旋转,因为我需要确保应用程序在横向模式下运行。问题是,摄像头支持横向模式,但拨号器不支持。所以,当我启动摄像头时,它没有问题,但拨号器导致了纵向旋转,这导致了WebView在旋转屏幕时的默认行为onDestroy(),并导致随后重新加载…谢谢,这是可行的,但只要我使用
它就开始再次调用onDestroy(),onNewIntent()根据logcat,从不调用。我只是不明白,它在启动摄像头活动时工作正常,但在启动拨号活动时它坏了。