java.lang.NullPointerException: Attempt to read from field 'com.x.x.models.ObjectModel$ModelTypes com.x.x.models.ObjectModel.type' on a null object reference

Stack Overflow | Diego Marrs | 4 months ago
  1. 0

    How should I initialize and display my empty list?

    Stack Overflow | 4 months ago | Diego Marrs
    java.lang.NullPointerException: Attempt to read from field 'com.x.x.models.ObjectModel$ModelTypes com.x.x.models.ObjectModel.type' on a null object reference
  2. 0
    samebug tip
    Upgrade BetterPickers to 2.0.0 or later.
    via GitHub by bbbenja
  3. 0
    samebug tip
    You can't use hide() or remove() or many things with NULL values, try checking for NULL before calling this methods.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    samebug tip
    Also, check if you're not using android.support.v4.app.FragmentTransaction with android.app.Fragment and vice-versa
  6. 0
    samebug tip
    The resource was accessed after it was dismissed.

    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 read from field 'com.x.x.models.ObjectModel$ModelTypes com.x.x.models.ObjectModel.type' on a null object reference

      at com.x.x.adapters.ListAdapter.getItemViewType()
    2. com.x.x
      ListAdapter.getItemViewType
      1. com.x.x.adapters.ListAdapter.getItemViewType(ListAdapter.java:32)
      1 frame
    3. Android v7
      RecyclerView.onLayout
      1. android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4664)
      2. android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4617)
      3. android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1994)
      4. android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1390)
      5. android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1353)
      6. android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:574)
      7. android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3028)
      8. android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2906)
      9. android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3283)
      9 frames
    4. Android Platform
      ActivityThread.main
      1. android.view.View.layout(View.java:15654)
      2. android.view.ViewGroup.layout(ViewGroup.java:4969)
      3. android.widget.RelativeLayout.onLayout(RelativeLayout.java:1077)
      4. android.view.View.layout(View.java:15654)
      5. android.view.ViewGroup.layout(ViewGroup.java:4969)
      6. android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
      7. android.widget.FrameLayout.onLayout(FrameLayout.java:508)
      8. android.view.View.layout(View.java:15654)
      9. android.view.ViewGroup.layout(ViewGroup.java:4969)
      10. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1705)
      11. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1559)
      12. android.widget.LinearLayout.onLayout(LinearLayout.java:1468)
      13. android.view.View.layout(View.java:15654)
      14. android.view.ViewGroup.layout(ViewGroup.java:4969)
      15. android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
      16. android.widget.FrameLayout.onLayout(FrameLayout.java:508)
      17. android.view.View.layout(View.java:15654)
      18. android.view.ViewGroup.layout(ViewGroup.java:4969)
      19. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1705)
      20. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1559)
      21. android.widget.LinearLayout.onLayout(LinearLayout.java:1468)
      22. android.view.View.layout(View.java:15654)
      23. android.view.ViewGroup.layout(ViewGroup.java:4969)
      24. android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
      25. android.widget.FrameLayout.onLayout(FrameLayout.java:508)
      26. android.view.View.layout(View.java:15654)
      27. android.view.ViewGroup.layout(ViewGroup.java:4969)
      28. android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2102)
      29. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1859)
      30. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1078)
      31. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5875)
      32. android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
      33. android.view.Choreographer.doCallbacks(Choreographer.java:580)
      34. android.view.Choreographer.doFrame(Choreographer.java:550)
      35. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
      36. android.os.Handler.handleCallback(Handler.java:739)
      37. android.os.Handler.dispatchMessage(Handler.java:95)
      38. android.os.Looper.loop(Looper.java:135)
      39. android.app.ActivityThread.main(ActivityThread.java:5351)
      39 frames
    5. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      2. java.lang.reflect.Method.invoke(Method.java:372)
      2 frames
    6. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
      2 frames