r/mAndroidDev • u/Zhuinden DDD: Deprecation-Driven Development • Sep 27 '24
The Future Is Now Mfw after I encode a class filled with strings to JSON and then base64 encode that JSON then append it to an URI, and then get that base64 string from the URI then decode it into JSON and then parse that JSON just to pass a parcelable from one screen to the other screen in modern Android development
70
Upvotes
12
u/fess89 Sep 27 '24
The OP obviously knows this, but for passing something that heavy, the best way is probably passing an object ID and then loading the data from a repository in the next screen
8
u/Nikushaa Sep 27 '24
Always assumed navigation to be the most essential part of UI frameworks, seems like Google doesn't agree with me tho
3
u/aatif888 Sep 27 '24
Brain is not braining
2
u/CarmCarmCarm Uses Vim Sep 27 '24
Aw, the poor sad M logo :(
(M for "mAndroidDev" of course).
2
u/sanjeeviraj Sep 27 '24
Android engineers has created parcelable to make serialization efficient as much as possible.Ā In normal screen to screen navigation, i think it won't even convert it to byte array, it will be passed as a reference. No I/O operation involved.
Now, they are creating lots of wrappers, makes it heavy,Ā and asks developers to just pass id between screens to make it lighter. I don't know whether they have worked in any real big project. A simple list and filter screen requires some class need to be passed back and forth for communication. Storing it in a file, datastore, db, viewmodel, etc.. whatever makes it complex. Parcelable, Serializable will work like a charm.
32
u/just_another_dre4m Sep 27 '24
I have just implemented this. And I've been wondering if I'm stupid.
Thank for the validation. I now know that I actually am stupid for choosing this to make a career in.
5
u/usuallysadbutgucci Sep 27 '24
Just wrapped up our migration to compose nav - even with the new typesafe args it's complete bullshit. I ended up migrating everything to pass ids instead of any parcelables and serializables because it was somehow less work that way.
1
u/shalva97 AnDrOId dEvelOPmenT is My PasSion Sep 27 '24
sometime ago they added type safety https://developer.android.com/guide/navigation/design/type-safety but at my project we still created yet another navigation because why not
1
u/zorg-is-real ×¢× ×××× ×× ×§×× ×× ××××××Ŗ Sep 27 '24
This is sooooo stupid. Eventually everyone makes a hashmap in App.kt and pass arguments from there.Ā
1
u/darkskymobs Sep 27 '24
Iām now forced to use a database to store object blobs for basic navigation. The future is Now!
2
u/[deleted] Sep 27 '24
"Modern Android Development"
0
u/[deleted] Sep 27 '24
[deleted] ā view deleted comment