java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Paint.getAlpha()' on a null object reference

Stack Overflow | Nevermore | 2 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
    samebug tip
    Android has some problem with big images, so, probably, the image you're trying to use is too big for Canvas. You can either use Picasso or compress your image to reduce it's size (both pixel wise and filesize wise)
  2. 0

    why did it report a null pointer error when nine_patch added alpha?

    Stack Overflow | 2 months ago | Nevermore
    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Paint.getAlpha()' on a null object reference
  3. 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.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    samebug tip
    This issue was solved in 2.2.6. If updating doesn't solve, try using notifyItemRangeChanged(1, mDatas.size()) instead of notifyItemRangeChanged(0, mDatas.size()).
  6. 0

    how to navigate from one activity(Crypt) to another (Encrypt) activity i.e from user_menu(crypt) item to main.xml page?Please help me

    Android Enthusiasts | 4 days ago | nikkita
    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.graphics.drawable.Drawable.setState(int[])' on a null object reference

    1 unregistered visitors
    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 'int android.graphics.Paint.getAlpha()' on a null object reference

      at android.graphics.drawable.NinePatchDrawable.draw()
    2. Android Platform
      FrameLayout.draw
      1. android.graphics.drawable.NinePatchDrawable.draw(NinePatchDrawable.java:250)
      2. android.view.View.getDrawableRenderNode(View.java:15463)
      3. android.view.View.drawBackground(View.java:15412)
      4. android.view.View.draw(View.java:15222)
      5. android.view.View.updateDisplayListIfDirty(View.java:14167)
      6. android.view.View.getDisplayList(View.java:14189)
      7. android.view.View.draw(View.java:14959)
      8. android.view.ViewGroup.drawChild(ViewGroup.java:3405)
      9. android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
      10. android.view.View.updateDisplayListIfDirty(View.java:14162)
      11. android.view.View.getDisplayList(View.java:14189)
      12. android.view.View.draw(View.java:14959)
      13. android.view.ViewGroup.drawChild(ViewGroup.java:3405)
      14. android.widget.ListView.drawChild(ListView.java:3396)
      15. android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
      16. android.widget.AbsListView.dispatchDraw(AbsListView.java:2603)
      17. android.widget.ListView.dispatchDraw(ListView.java:3391)
      18. android.view.View.draw(View.java:15234)
      19. android.widget.AbsListView.draw(AbsListView.java:4110)
      20. android.view.View.updateDisplayListIfDirty(View.java:14167)
      21. android.view.View.getDisplayList(View.java:14189)
      22. android.view.View.draw(View.java:14959)
      23. android.view.ViewGroup.drawChild(ViewGroup.java:3405)
      24. android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
      25. android.view.View.draw(View.java:15234)
      26. android.view.View.updateDisplayListIfDirty(View.java:14167)
      27. android.view.View.getDisplayList(View.java:14189)
      28. android.view.View.draw(View.java:14959)
      29. android.view.ViewGroup.drawChild(ViewGroup.java:3405)
      30. android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
      31. android.view.View.updateDisplayListIfDirty(View.java:14162)
      32. android.view.View.getDisplayList(View.java:14189)
      33. android.view.View.draw(View.java:14959)
      34. android.view.ViewGroup.drawChild(ViewGroup.java:3405)
      35. android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
      36. android.view.View.updateDisplayListIfDirty(View.java:14162)
      37. android.view.View.getDisplayList(View.java:14189)
      38. android.view.View.draw(View.java:14959)
      39. android.view.ViewGroup.drawChild(ViewGroup.java:3405)
      40. android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
      41. android.view.View.updateDisplayListIfDirty(View.java:14162)
      42. android.view.View.getDisplayList(View.java:14189)
      43. android.view.View.draw(View.java:14959)
      44. android.view.ViewGroup.drawChild(ViewGroup.java:3405)
      45. android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
      46. android.view.View.updateDisplayListIfDirty(View.java:14162)
      47. android.view.View.getDisplayList(View.java:14189)
      48. android.view.View.draw(View.java:14959)
      49. android.view.ViewGroup.drawChild(ViewGroup.java:3405)
      50. android.view.ViewGroup.dispatchDraw(ViewGroup.java:3198)
      51. android.view.View.draw(View.java:15234)
      52. android.widget.FrameLayout.draw(FrameLayout.java:598)
      52 frames
    3. Android
      PhoneWindow$DecorView.draw
      1. com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2650)
      1 frame
    4. Android Platform
      Choreographer.doCallbacks
      1. android.view.View.updateDisplayListIfDirty(View.java:14167)
      2. android.view.View.getDisplayList(View.java:14189)
      3. android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:273)
      4. android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:279)
      5. android.view.ThreadedRenderer.draw(ThreadedRenderer.java:318)
      6. android.view.ViewRootImpl.draw(ViewRootImpl.java:2530)
      7. android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2352)
      8. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1982)
      9. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1061)
      10. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)
      11. android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
      12. android.view.Choreographer.doCallbacks(Choreographer.java:580)
      12 frames