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

Stack Overflow | JackW5808 | 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

    FragmentStatePageAdapter crash when using support lib v4 21.0.3

    Stack Overflow | 2 years ago | Constantin Cerberus
    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' 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

    No indication as to where NPE could occur

    Stack Overflow | 2 months ago | JackW5808
    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    NullPointerException without the line of code where the error occured

    Stack Overflow | 2 months ago | JackW5808
    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference
  6. 0

    Content of ViewPager disapear after changing fragments

    Stack Overflow | 1 month ago | Alexandre MICHAUD
    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

  1. Macapon 8 times, last 1 year ago
3 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 java.util.ArrayList.size()' on a null object reference

    at android.support.v4.app.FragmentManagerImpl.getFragment()
  2. Android Support v4
    ViewPager.onRestoreInstanceState
    1. android.support.v4.app.FragmentManagerImpl.getFragment(FragmentManager.java:873)
    2. android.support.v4.app.FragmentStatePagerAdapter.restoreState(FragmentStatePagerAdapter.java:215)
    3. android.support.v4.view.ViewPager.onRestoreInstanceState(ViewPager.java:1481)
    3 frames
  3. Android Platform
    View.restoreHierarchyState
    1. android.view.View.dispatchRestoreInstanceState(View.java:15751)
    2. android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3231)
    3. android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3237)
    4. android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3237)
    5. android.view.View.restoreHierarchyState(View.java:15729)
    5 frames
  4. Android Support v4
    FragmentManagerImpl$1.run
    1. android.support.v4.app.Fragment.restoreViewState(Fragment.java:475)
    2. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1329)
    3. android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
    4. android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
    5. android.support.v4.app.BackStackRecord.executePopOps(BackStackRecord.java:803)
    6. android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2353)
    7. android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2146)
    8. android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2098)
    9. android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2008)
    10. android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
    10 frames
  5. Android Platform
    ActivityThread.main
    1. android.os.Handler.handleCallback(Handler.java:751)
    2. android.os.Handler.dispatchMessage(Handler.java:95)
    3. android.os.Looper.loop(Looper.java:154)
    4. android.app.ActivityThread.main(ActivityThread.java:6119)
    4 frames
  6. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invoke(Native Method)
    1 frame
  7. 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