这是什么原因?

  Process: com.weather.com.welcomeactivity, PID: 8304

    java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.SharedPreferences android.content.Context.getSharedPreferences(java.lang.String, int)' on a null object reference

 at com.weather.com.welcomeactivity.utils.CacheUtils.getString(CacheUtils.java:46)

 at com.weather.com.welcomeactivity.shoppingcart.utils.CartProvider.getDataFromLocal(CartProvider.java:73)

  at com.weather.com.welcomeactivity.shoppingcart.utils.CartProvider.getAllData(CartProvider.java:66)

   at com.weather.com.welcomeactivity.shoppingcart.utils.CartProvider.listToSparse(CartProvider.java:44)

    at com.weather.com.welcomeactivity.shoppingcart.utils.CartProvider.<init>(CartProvider.java:32)

    at com.weather.com.welcomeactivity.shoppingcart.utils.CartProvider.getInstance(CartProvider.java:38)

    at com.weather.com.welcomeactivity.app.GoodsInfoActivity.onClick(GoodsInfoActivity.java:163)

    at android.view.View.performClick(View.java:5637)

    at android.view.View$PerformClick.run(View.java:22429)

    at android.os.Handler.handleCallback(Handler.java:751)

    at android.os.Handler.dispatchMessage(Handler.java:95)

    at android.os.Looper.loop(Looper.java:154)

    at android.app.ActivityThread.main(ActivityThread.java:6119)

    at java.lang.reflect.Method.invoke(Native Method)

    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)

    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

                                                                               

                                                                               


qq_Linjj蓝极光辉_04362138
浏览 840回答 1
1回答

qq_2雨水_04090191

NullPointerException,这个单词的意思就是说你的代码运行到某一步的时候报空指针异常了,后面那些就是说的是你代码的行数,哪一行有问题。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Android