java.lang.NullPointerException: Attempt to get length of null array

Stack Overflow | Kerstin M. | 5 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    image retrieved from cursor is null (simplecursoradapter)

    Stack Overflow | 5 months ago | Kerstin M.
    java.lang.NullPointerException: Attempt to get length of null array

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to get length of null array

      at com.example.koesc_000.pocketdiary.DbBitmapUtility.getImage()
    2. com.example.koesc_000
      SearchActivity$1.setViewValue
      1. com.example.koesc_000.pocketdiary.DbBitmapUtility.getImage(DbBitmapUtility.java:30)
      2. com.example.koesc_000.pocketdiary.Activities.SearchActivity$1.setViewValue(SearchActivity.java:83)
      2 frames
    3. Android Platform
      ActivityThread.main
      1. android.widget.SimpleCursorAdapter.bindView(SimpleCursorAdapter.java:146)
      2. android.widget.CursorAdapter.getView(CursorAdapter.java:254)
      3. android.widget.AbsListView.obtainView(AbsListView.java:2823)
      4. android.widget.ListView.makeAndAddView(ListView.java:1884)
      5. android.widget.ListView.fillDown(ListView.java:713)
      6. android.widget.ListView.fillFromTop(ListView.java:779)
      7. android.widget.ListView.layoutChildren(ListView.java:1693)
      8. android.widget.AbsListView.onLayout(AbsListView.java:2627)
      9. android.view.View.layout(View.java:16711)
      10. android.view.ViewGroup.layout(ViewGroup.java:5328)
      11. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1702)
      12. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1556)
      13. android.widget.LinearLayout.onLayout(LinearLayout.java:1465)
      14. android.view.View.layout(View.java:16711)
      15. android.view.ViewGroup.layout(ViewGroup.java:5328)
      16. android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
      17. android.widget.FrameLayout.onLayout(FrameLayout.java:508)
      18. android.view.View.layout(View.java:16711)
      19. android.view.ViewGroup.layout(ViewGroup.java:5328)
      20. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1702)
      21. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1556)
      22. android.widget.LinearLayout.onLayout(LinearLayout.java:1465)
      23. android.view.View.layout(View.java:16711)
      24. android.view.ViewGroup.layout(ViewGroup.java:5328)
      25. android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
      26. android.widget.FrameLayout.onLayout(FrameLayout.java:508)
      27. android.view.View.layout(View.java:16711)
      28. android.view.ViewGroup.layout(ViewGroup.java:5328)
      29. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1702)
      30. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1556)
      31. android.widget.LinearLayout.onLayout(LinearLayout.java:1465)
      32. android.view.View.layout(View.java:16711)
      33. android.view.ViewGroup.layout(ViewGroup.java:5328)
      34. android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
      35. android.widget.FrameLayout.onLayout(FrameLayout.java:508)
      36. android.view.View.layout(View.java:16711)
      37. android.view.ViewGroup.layout(ViewGroup.java:5328)
      38. android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2319)
      39. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2032)
      40. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1191)
      41. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6642)
      42. android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
      43. android.view.Choreographer.doCallbacks(Choreographer.java:590)
      44. android.view.Choreographer.doFrame(Choreographer.java:560)
      45. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
      46. android.os.Handler.handleCallback(Handler.java:739)
      47. android.os.Handler.dispatchMessage(Handler.java:95)
      48. android.os.Looper.loop(Looper.java:145)
      49. android.app.ActivityThread.main(ActivityThread.java:5942)
      49 frames
    4. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:372)
      2 frames
    5. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
      2 frames