Why not save bundle in onCreate of Activity / Fragment?
Hi, I found that this tool check bundle only when onSaveInstanceState is called. But if put a big data in Bundle when open Activity or Fragment, it does not work.
Hi @zysidea - You're right that the same exception can be thrown when calling startActivity or when adding a fragment if the intent extras or fragment args are too big. If I remember rightly, the problem for is that *TransactionTooLargeException is thrown before the onCreate callback so our activity/fragment state listeners don't get a change to log anything.
You can still use the functions in the library "manually" to check any bundles you suspect are causing problems e.g.
val myIntent = // your existing Intent creation code
TooLargeTool.logBundleBreakdown(tag = "CheckBigIntent", bundle = myIntent.extras)
startActivity(myIntent)
We could probably make that kind of usage easier and better documented than it is and possibly now we could even have Kotlin extension functions like this?
startActivityLoggingExtras(myIntent)