您好,登錄后才能下訂單哦!
FATAL EXCEPTION: main
ava.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=291, result=801, data=Intent { cmp=com.example.simplecalc/.CalculationTypeActivity (has extras) }} to activity {com.example.simplecalc/com.example.simplecalc.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.deliverResults(ActivityThread.java:3367)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3410)
at android.app.ActivityThread.access$1100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.example.simplecalc.MainActivity.onActivityResult(MainActivity.java:49)
at android.app.Activity.dispatchActivityResult(Activity.java:5322)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3363)
... 11 more
錯誤之處通過Log.d()等Log函數(shù)定位,發(fā)現(xiàn)很簡單的是
calcTypeText.setText(ConstantInfo.typeMap.get(calcType));
中TextView變量calcTypeText沒有和界面TextView對象綁定。
關(guān)鍵時注意錯誤信息中的java.lang.NullPointerException,指針為null拋出的異常。
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。