oubowu/SlideBack

return (ViewGroup) activity.getWindow().getDecorView() java.lang.NullPointerException

imishx opened this issue · 10 comments

SlideBackHelper 中getDecorView方法空指针异常,是不是activity被回收了?

贴log咯

java.lang.RuntimeException: Unable to start activity ComponentInfo{indi.free.app/indi.free.app.act.impl.WebInfo_}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window android.app.Activity.getWindow()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2423)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
java.lang.RuntimeException: Unable to start activity ComponentInfo{indi.free.app/indi.free.app.act.impl.WebInfo_}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window android.app.Activity.getWindow()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2423)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
at android.app.ActivityThread.access$900(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
at com.limpoxe.fairy.core.b.handleMessage(PluginAppTrace.java:40)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5441)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.Window android.app.Activity.getWindow()' on a null object reference
at indi.free.app.view.slideback.b.a(SlideBackHelper.java:23)
at indi.free.app.view.slideback.b.c(SlideBackHelper.java:31)
at indi.free.app.view.slideback.b.a(SlideBackHelper.java:56)
at indi.free.app.act.impl.WebInfo.onCreate(WebInfo.java:226)
at indi.free.app.act.impl.WebInfo_.onCreate(WebInfo_.java:40)
at android.app.Activity.performCreate(Activity.java:6303)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at com.limpoxe.fairy.core.g.callActivityOnCreate(PluginInstrumentionWrapper.java:276)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
... 10 more

9h0st commented

就是被回收了,需要在开始华东时也去Check一下之前的activity是不是空

我只在indi.free.app.act.impl.WebInfo_这个Activity设置了侧滑退出,根据log来看好像这个activity没启动起来就崩溃了,不像是滑动的时候崩溃的

这个是不是启动的activity???

不是

而且不是所有手机又这个问题,您提供的demo也有这个问题,连续启动多有SecondActivity,一直滑动退出,一会就崩溃了

连续快速滑动退出的时候

你拉下代码再试下 @imishx

可以了,3Q