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


Solutions on the web

Solution icon of stackoverflow
via Stack Overflow by JackW5808
, 8 months ago
Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

Solution icon of stackoverflow
Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

Solution icon of github
via GitHub by kacpi2442
, 8 months ago
Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

Solution icon of stackoverflow
Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

Solution icon of web
Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

Solution icon of github
Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

Solution icon of stackoverflow
Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

Solution icon of stackoverflow
Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

Solution icon of web
Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

Solution icon of web
Attempt to invoke virtual method 'int java.util.ArrayList.size()' on a null object reference

Stack trace

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(FragmentManager.java:873)
	at android.support.v4.app.FragmentStatePagerAdapter.restoreState(FragmentStatePagerAdapter.java:215)
	at android.support.v4.view.ViewPager.onRestoreInstanceState(ViewPager.java:1481)
	at android.view.View.dispatchRestoreInstanceState(View.java:15751)
	at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3231)
	at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3237)
	at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:3237)
	at android.view.View.restoreHierarchyState(View.java:15729)
	at android.support.v4.app.Fragment.restoreViewState(Fragment.java:475)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1329)
	at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
	at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
	at android.support.v4.app.BackStackRecord.executePopOps(BackStackRecord.java:803)
	at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2353)
	at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2146)
	at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2098)
	at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2008)
	at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
	at android.os.Handler.handleCallback(Handler.java:751)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:154)
	at android.app.ActivityThread.main(ActivityThread.java:6119)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
76 times, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Once, 10 months ago