gpt4 book ai didi

java - 无法定位错误源

转载 作者:行者123 更新时间:2023-12-01 12:33:10 25 4
gpt4 key购买 nike

我在 MainActivity 中遇到这个奇怪的错误,无法自己重现它,但这就是我在崩溃报告中得到的内容:

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65538, result=0, data=null} to activity {lv.mobi.android/lv.mobi.android.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:3455)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3498)
at android.app.ActivityThread.access$1300(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:212)
at android.app.ActivityThread.main(ActivityThread.java:5135)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at lv.mobi.android.b.aj.a(Unknown Source)
at android.support.v4.app.FragmentActivity.onActivityResult(Unknown Source)
at lv.mobi.android.MainActivity.onActivityResult(Unknown Source)
at android.app.Activity.dispatchActivityResult(Activity.java:5423)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3451)
... 11 more

我认为它可能是onActivityResult中的某些内容,但无法弄清楚是什么,我的结果函数中没有太多内容:

    @Override
protected void onActivityResult(int _requestCode, int _resultCode, Intent _data) {
super.onActivityResult(_requestCode, _resultCode, _data);
if(_resultCode==Activity.RESULT_OK){
reloadUser();
}
}

最佳答案

根据我的猜测,您需要输入以下代码

 if(resultCode != RESULT_CANCELED){
if(_resultCode==Activity.RESULT_OK){
reloadUser();
}
}

因为您正在取消该 Activity/流程,因为该 Intent 正在获取空值。

关于java - 无法定位错误源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25784845/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com