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

Stack Overflow | Mark Ligot | 4 months ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael . Or join the community to write better ones.
  1. 0

    create a new view after a successful dragdrop operation

    Stack Overflow | 4 months ago | Mark Ligot
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
  2. 0
    samebug tip
    When you use findViewById inside an activity it is going to look for a View inside your main_activity.xml. If it's not there, it throws this exception, try to use the right view to call findviewById.
  3. 0

    Given view not a child of Activity Error

    Stack Overflow | 4 months ago | Mark Ligot
    java.lang.IllegalArgumentException: Given view not a child of info.androidhive.tabsswipe.dragview.DragLayer{969900b V.E...... ......ID 0,0-1080,1605 #7f090010 app:id/drag_layer}
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    getResources() return an error

    Stack Overflow | 1 year ago | J. Arnold
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
  6. 0

    Android Json Parsing App

    Stack Overflow | 2 years ago | Android007
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.NullPointerException

    Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference

    at android.content.ContextWrapper.getResources()
  2. Android Platform
    ImageView.<init>
    1. android.content.ContextWrapper.getResources(ContextWrapper.java:86)
    2. android.view.ContextThemeWrapper.getResourcesInternal(ContextThemeWrapper.java:127)
    3. android.view.ContextThemeWrapper.getResources(ContextThemeWrapper.java:121)
    4. android.view.View.<init>(View.java:4012)
    5. android.widget.ImageView.<init>(ImageView.java:141)
    5 frames
  3. info.androidhive.tabsswipe
    DragLayer.onTouchEvent
    1. info.androidhive.tabsswipe.dragview.DragActivityV2.showPlayAgainBtn(DragActivityV2.java:515)
    2. info.androidhive.tabsswipe.dragview.DragController.onTouchEvent(DragController.java:438)
    3. info.androidhive.tabsswipe.dragview.DragLayer.onTouchEvent(DragLayer.java:69)
    3 frames
  4. Android Platform
    ViewGroup.dispatchTouchEvent
    1. android.view.View.dispatchTouchEvent(View.java:10023)
    2. android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2626)
    3. android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2307)
    4. android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632)
    5. android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2321)
    6. android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632)
    7. android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2321)
    8. android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2632)
    9. android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2321)
    9 frames
  5. Android
    PhoneWindow.superDispatchTouchEvent
    1. com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:413)
    2. com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1808)
    2 frames
  6. Android Platform
    Activity.dispatchTouchEvent
    1. android.app.Activity.dispatchTouchEvent(Activity.java:3061)
    1 frame
  7. Android
    DecorView.dispatchTouchEvent
    1. com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:375)
    1 frame
  8. Android Platform
    ActivityThread.main
    1. android.view.View.dispatchPointerEvent(View.java:10243)
    2. android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4438)
    3. android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4306)
    4. android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3853)
    5. android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3906)
    6. android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3872)
    7. android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3999)
    8. android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3880)
    9. android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4056)
    10. android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3853)
    11. android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3906)
    12. android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3872)
    13. android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3880)
    14. android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3853)
    15. android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6246)
    16. android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6220)
    17. android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6181)
    18. android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6349)
    19. android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
    20. android.os.MessageQueue.nativePollOnce(Native Method)
    21. android.os.MessageQueue.next(MessageQueue.java:323)
    22. android.os.Looper.loop(Looper.java:136)
    23. android.app.ActivityThread.main(ActivityThread.java:6119)
    23 frames
  9. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invoke(Native Method)
    1 frame
  10. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
    2 frames