您好,登錄后才能下訂單哦!
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函數定位,發現很簡單的是
calcTypeText.setText(ConstantInfo.typeMap.get(calcType));
中TextView變量calcTypeText沒有和界面TextView對象綁定。
關鍵時注意錯誤信息中的java.lang.NullPointerException,指針為null拋出的異常。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。