java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference

GitHub | gauravjain131 | 3 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

    Getting NPE in onMeasure().

    GitHub | 3 months ago | gauravjain131
    java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference
  2. 0

    NPE when using include layout

    Stack Overflow | 9 months ago | leenolasco
    java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getVisibility()' on a null object reference
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 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()).
  5. 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.

  1. korman 1 times, last 10 months ago
9 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 interface method 'int java.util.List.size()' on a null object reference

    at android.widget.ArrayAdapter.getCount()
  2. Android Platform
    View.measure
    1. android.widget.ArrayAdapter.getCount(ArrayAdapter.java:330)
    2. android.widget.ListView.onMeasure(ListView.java:1151)
    3. android.view.View.measure(View.java:17438)
    4. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5464)
    5. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    6. android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    7. android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    8. android.view.View.measure(View.java:17438)
    8 frames
  3. in.til.popkorn
    SlidingUpPanelLayout.onMeasure
    1. in.til.popkorn.ui.widget.SlidingUpPanelLayout.onMeasure(SourceFile:802)
    1 frame
  4. Android Platform
    FrameLayout.onMeasure
    1. android.view.View.measure(View.java:17438)
    2. android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:728)
    3. android.widget.RelativeLayout.onMeasure(RelativeLayout.java:464)
    4. android.view.View.measure(View.java:17438)
    5. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5464)
    6. android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    6 frames
  5. Android v7
    ContentFrameLayout.onMeasure
    1. android.support.v7.widget.ContentFrameLayout.onMeasure(SourceFile:135)
    1 frame
  6. Android Platform
    FrameLayout.onMeasure
    1. android.view.View.measure(View.java:17438)
    2. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5464)
    3. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    4. android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    5. android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    6. android.view.View.measure(View.java:17438)
    7. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5464)
    8. android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    9. android.view.View.measure(View.java:17438)
    10. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5464)
    11. android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436)
    12. android.widget.LinearLayout.measureVertical(LinearLayout.java:722)
    13. android.widget.LinearLayout.onMeasure(LinearLayout.java:613)
    14. android.view.View.measure(View.java:17438)
    15. android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5464)
    16. android.widget.FrameLayout.onMeasure(FrameLayout.java:430)
    16 frames
  7. Android
    PhoneWindow$DecorView.onMeasure
    1. com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2560)
    1 frame
  8. Android Platform
    ActivityThread.main
    1. android.view.View.measure(View.java:17438)
    2. android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2001)
    3. android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1166)
    4. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1372)
    5. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
    6. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5786)
    7. android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
    8. android.view.Choreographer.doCallbacks(Choreographer.java:580)
    9. android.view.Choreographer.doFrame(Choreographer.java:550)
    10. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
    11. android.os.Handler.handleCallback(Handler.java:739)
    12. android.os.Handler.dispatchMessage(Handler.java:95)
    13. android.os.Looper.loop(Looper.java:135)
    14. android.app.ActivityThread.main(ActivityThread.java:5221)
    14 frames
  9. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invoke(Method.java)
    2. java.lang.reflect.Method.invoke(Method.java:372)
    2 frames
  10. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
    2 frames