msahakyan / nested-recycler-view

Shows how to create android vertical recyclerView with nested horizontal linear recycler view
191 stars 57 forks source link

java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference #3

Open pranaypatel512 opened 8 years ago

pranaypatel512 commented 8 years ago

Thanks for nice nested recycler view example. I just got an error log as below:

FATAL EXCEPTION: main Process: com.android.msahakyan.nestedrecycler, PID: 32247 java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference at android.widget.Toast.<init>(Toast.java:102) at android.widget.Toast.makeText(Toast.java:259) at com.android.msahakyan.nestedrecycler.fragment.MovieDetailFragment$2.onError(MovieDetailFragment.java:216) at com.android.msahakyan.nestedrecycler.net.NetworkUtilsImpl$2.onErrorResponse(NetworkUtilsImpl.java:46) at com.android.volley.Request.deliverError(Request.java:563) at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:101) at android.os.Handler.handleCallback(Handler.java:746) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5443) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

bbf-developer commented 6 years ago

This problem is for a another element use the getContext or getActivity in your class