IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 140, found: 150
See original GitHub issueIn the contributions activity, when opening any of my uploaded pictures I get the following crash either immediately or after changing screen orientation a few times. I can reproduce the crash easily, both in latest master and in branch marcosliberal:fix-issue-3906
.
02-26 17:25:29.772 16399 16513 D OkHttp : --> GET https://commons.wikimedia.org/w/api.php?action=query&format=json&formatversion=2&generator=allimages&gaisort=timestamp&gaidir=older&prop=imageinfo&iiprop=url|extmetadata|user&&iiurlwidth=640&iiextmetadatafilter=DateTime|Categories|GPSLatitude|GPSLongitude|ImageDescription|DateTimeOriginal|Artist|LicenseShortName|LicenseUrl&gaiuser=Syced&gailimit=10&gaicontinue=20210103154838|1%E6%9C%883%E6%97%A5(%E6%97%A5)%E3%81%AF%E6%9D%B1%E4%BA%AC%E3%82%BF%E3%83%AF%E3%83%BC%E3%82%92%E5%8F%B0%E6%B9%BE%E8%89%B2%E3%81%AB%E3%83%A9%E3%82%A4%E3%83%88%E3%82%A2%E3%83%83%E3%83%97_4.jpg&continue=gaicontinue||
02-26 17:25:29.774 16399 16513 D CookieManager: Domain:commons.wikimedia.org
02-26 17:25:29.793 5618 5825 D WifiStateMachine: enter getWifiLinkLayerStats
02-26 17:25:29.793 5618 5825 I WifiVendorHal: getWifiLinkLayerStats(l.2973) before calling iface.getLinkLayerStats
02-26 17:25:29.793 5144 5144 I android.hardware.wifi@1.0-service: enter getLinkLayerStats
02-26 17:25:29.793 5144 5144 I android.hardware.wifi@1.0-service: enter getLinkLayerStatsInternal
02-26 17:25:29.799 16399 16399 D AndroidRuntime: Shutting down VM
02-26 17:25:29.800 16399 16399 E AndroidRuntime: FATAL EXCEPTION: main
02-26 17:25:29.800 16399 16399 E AndroidRuntime: Process: fr.free.nrw.commons, PID: 16399
02-26 17:25:29.800 16399 16399 E AndroidRuntime: java.lang.IllegalStateException: The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: 140, found: 150 Pager id: fr.free.nrw.commons:id/mediaDetailsPager Pager class: class androidx.viewpager.widget.ViewPager Problematic adapter: class fr.free.nrw.commons.media.MediaDetailPagerFragment$MediaDetailAdapter
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1143)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at androidx.viewpager.widget.ViewPager.populate(ViewPager.java:1092)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at androidx.viewpager.widget.ViewPager$3.run(ViewPager.java:273)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at android.view.Choreographer.doCallbacks(Choreographer.java:761)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at android.view.Choreographer.doFrame(Choreographer.java:693)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:873)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7032)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
02-26 17:25:29.800 16399 16399 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
5 hours later, I get the same crash with different numbers: Expected adapter item count: 590, found: 600
I guess the app is somehow busy loading my thousands of past contributions, and miscalculating something while this happens. The crash might not be reproduced on account with few contributions. It does not happen in Explore either.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
The application's PagerAdapter changed the adapter's content ...
IllegalStateException : The application's PagerAdapter changed the adapter's content without calling PagerAdapter#notifyDataSetChanged! Expected adapter item ...
Read more >without calling PagerAdapter#notifyDataSetChanged! - MSDN
IllegalStateException : The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged!
Read more >The application's PagerAdapter changed the adapter's ...
The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged.
Read more >Migrate from ViewPager to ViewPager2 - Android Developers
If your app already uses ViewPager , read this page to learn more about migrating to ViewPager2 . If you want to use...
Read more >viewpager/src/main/java/androidx/viewpager/widget ...
throw new IllegalStateException("The application's PagerAdapter changed the adapter's". + " contents without calling PagerAdapter#notifyDataSetChanged!".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This occurs for me on 3.0-release branch even after cherrypicking #4354 onto it. It doesn’t even require me to switch orientation, sometimes it happens on start or when I swipe left to view the next picture.
@nicolas-raoul I think this is also resolved ??