Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not save bundle in onCreate of Activity / Fragment? #35

Open
zysidea opened this issue Nov 21, 2020 · 1 comment
Open

Why not save bundle in onCreate of Activity / Fragment? #35

zysidea opened this issue Nov 21, 2020 · 1 comment

Comments

@zysidea
Copy link

zysidea commented Nov 21, 2020

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.

@maxspencer
Copy link
Contributor

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants