【发布时间】:2014-01-29 06:37:40
【问题描述】:
当我为我的应用小部件使用配置 Activity 时,一旦我使用带有 Android 4.4.2 和 GEL 启动器(默认启动器)的 Nexus 5 设置 RESULT_OK 离开 Activity,它就会崩溃。当我尝试使用 Android SDK API 示例小部件进行相同操作时,也会发生同样的情况。因此,我认为这不是我的代码的错。相同的代码使用我的 Nexus 4 及其默认启动器和相同的 Android 版本。错误日志(使用 API Examples Widget)如下:
I/GEL ( 8852): handleIntent(Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.google.android.googlequicksearchbox/com.google.android.launcher.GEL })
D/AndroidRuntime( 8852): Shutting down VM
W/dalvikvm( 8852): threadid=1: thread exiting with uncaught exception (group=0x415b8ba8)
E/AndroidRuntime( 8852): FATAL EXCEPTION: main
E/AndroidRuntime( 8852): Process: com.google.android.googlequicksearchbox, PID: 8852
E/AndroidRuntime( 8852): java.lang.RuntimeException: Unable to resume activity {com.google.android.googlequicksearchbox/com.google.android.launcher.GEL}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=5, result=-1, data=Intent { (has extras) }} to activity {com.google.android.googlequicksearchbox/com.google.android.launcher.GEL}: java.lang.NullPointerException
E/AndroidRuntime( 8852): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2788)
E/AndroidRuntime( 8852): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2817)
E/AndroidRuntime( 8852): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
E/AndroidRuntime( 8852): at android.app.ActivityThread.access$800(ActivityThread.java:135)
E/AndroidRuntime( 8852): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
E/AndroidRuntime( 8852): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 8852): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime( 8852): at android.app.ActivityThread.main(ActivityThread.java:5017)
E/AndroidRuntime( 8852): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 8852): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 8852): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
E/AndroidRuntime( 8852): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
E/AndroidRuntime( 8852): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 8852): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=5, result=-1, data=Intent { (has extras) }} to activity {com.google.android.googlequicksearchbox/com.google.android.launcher.GEL}: java.lang.NullPointerException
E/AndroidRuntime( 8852): at android.app.ActivityThread.deliverResults(ActivityThread.java:3365)
E/AndroidRuntime( 8852): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2775)
E/AndroidRuntime( 8852): ... 12 more
E/AndroidRuntime( 8852): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 8852): at com.android.launcher3.Launcher.onActivityResult(Launcher.java:804)
E/AndroidRuntime( 8852): at com.google.android.launcher.GEL.onActivityResult(GEL.java:206)
E/AndroidRuntime( 8852): at android.app.Activity.dispatchActivityResult(Activity.java:5423)
E/AndroidRuntime( 8852): at android.app.ActivityThread.deliverResults(ActivityThread.java:3361)
E/AndroidRuntime( 8852): ... 13 more
W/ActivityManager( 792): Force finishing activity com.google.android.googlequicksearchbox/com.google.android.launcher.GEL
查看 com.android.launcher3.Launcher.onActivityResult(Launcher.java:804) 的源代码似乎变量 mDragLayer 为空。有没有人可以解决这个问题?
【问题讨论】:
标签: android widget launcher homescreen