用户如何启动内部活动

时间:2014-09-28 12:45:44

标签: android android-intent

我在GooglePlay上有3个相同的崩溃报告,其中堆栈跟踪看起来好像用户直接启动了内部活动(对清单中设置的类别LAUNCHER没有intent-filter)。

有没有办法做到这一点,到目前为止我错过了?可以从当前活动创建一种快捷方式,并在以后使用它来直接启动该活动吗?

以下是来自GooglePlay的堆栈跟踪:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eb.ohrh.parawind.free/eb.wind.activity.logbook.LogBookSingleDispActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1728) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1747) at android.app.ActivityThread.access$1500(ActivityThread.java:155) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993) at android.os.Handler.dispatchMessage(Handler.java:130) at android.os.Looper.loop(SourceFile:351) at android.app.ActivityThread.main(ActivityThread.java:3814) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:538) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:659) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at eb.wind.views.mapv2.MapWithOverlay.isFlightMode(MapWithOverlay.java:599) at eb.wind.views.mapv2.MapWithOverlay.bindToModel(MapWithOverlay.java:335) at eb.wind.activity.logbook.LogBookSingleDispActivity$MyPagerAdapter.<init>(LogBookSingleDispActivity.java:189) at eb.wind.activity.logbook.LogBookSingleDispActivity.onCreate(LogBookSingleDispActivity.java:39) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1082) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1692) ... 11 more

LogBookSingleDispActivity是一个内部活动。没有其他活动的准备步骤就无法启动。

任何想法,这是怎么发生的。

1 个答案:

答案 0 :(得分:0)

你的过程不会永远存在。如果您的应用程序显示在最近任务列表中,但其进程已终止,当用户返回您的应用程序时(例如,通过最近任务列表),Android将返回用户他们上次执行的任何活动

还有其他一些场景,用户可能会进入内部&#34;活动(例如,来自您的某个应用小部件的Notifications之一)。

您需要确保您的应用能够在用户进入任何一项活动后继续存在。理想情况下,即使您的活动的先前实例已被破坏且您的流程已终止,您仍然使用savedInstanceState之类的内容使其显示出来。在不可能的情况下(例如,您需要用户重新进行身份验证),有各种解决方案(例如,检测您的会话已重置并使用startActivity()让用户访问登录活动)