Ashish Agrawal
Ashish Agrawal

Reputation: 1977

Android ViewPager2 library throwing Transactiontoolarge exception onpause event

enter image description hereI am getting TransactionTooLarge exception if page size = 50 and I press the home button. I checked the FragmentStateAdapter and found that 'saveState()' method is finalized. Please help me how to resolve this.

In ViewPager it was overriden by me using below link- https://medium.com/@mdmasudparvez/android-os-transactiontoolargeexception-on-nougat-solved-3b6e30597345

But no way in View pager2 library.

Upvotes: 4

Views: 612

Answers (1)

Pascal Ganaye
Pascal Ganaye

Reputation: 1364

I had terrible random crash with my fragments. The one megabyte limit is system wide, so it can crash at much lower thresholds.

I fixed the issue by stopping to use serialized objects and only passing integers into intents and fragment arguments.

Then fragments and activities can get the actual object from a repository using the integer id I gave to it. It is faster and with insight it is a lot simpler.

Upvotes: 1

Related Questions