That's because these solutions tend to build upon the Android framework instead of being completely agnostic. There are too many hacks involved to build solutions in top of the framework that don't work well, leading to a new solution with different hacks.
Right and the totally agnostic ones crash and burn all the time because Android implements a new paradigm and then 6-12 months later this agnostic thing gets it and you are late to get it so you ditch the framework and start implementing Android again.
There isn't a good solution for this churn except to not rely on third party frameworks. You either totally rewrite the parts of your app that these frameworks touched or you implement native solutions yourself. The shelf life of third party android frameworks and libraries is somewhere around two years.
Implementing new features. Something like react is really slow to offer support for these things. Flutter is better because you can always add it yourself fairly easily but if it is heavily tied to the android system then it's much harder. Adding new stuff with motionlayout is impossible in react, probably possible in flutter and really easy in Android.
the totally agnostic ones crash and burn all the time
The totally agnostic ones crash and burn because they ignore state persistence so they can only be used to make unstable crappy apps that forget what I input into textfields and stuff :(
That would be an interesting corner case. My guess is your classes still run on the JVM as long as you don't touch the Parcelable stuff (I haven't tried this), and it could make things easier perhaps. I don't work with Parcelable much, what advantages does it have over Serializable or manual key-value mapping in a Bundle or plain Map? CouldParcelable be ported to the JVM if you'd really want to be completely Android agnostic and insist on using this mechanism?
I don't work with Parcelable much, what advantages does it have over Serializable or manual key-value mapping in a Bundle or plain Map ?
I'm starting to realize I don't know enough about the customization of ObjectOutputStream to sufficiently answer this question. ¬¬
Could Parcelable be ported to the JVM if you'd really want to be completely Android agnostic and insist on using this mechanism?
Well Parcelable itself is Android-specific. If you can implement android.os.* things on JVM (kinda like how Robolectric attempts to stub things), then it could be possible.
Personally I use this StateBundle class that can be run in JVM unit tests but it's also Parcelable. I just wonder if I shoot myself in the foot by relying on this instead of, like, JSON strings?
Me neither, but at the core it's just serialization, whether you use JSON, Parcelable, Serializable, or Bundle. One or the other may be better for performance perhaps.
Well Parcelable itself is Android-specific. If you can implement android.os.* things on JVM
At the end it's just bytes, so you could create jvm.Parcelable which does the same thing, right?
Parcelable and Parcel actually do more than plain serialization. There's an IBinder binding the both sides of the IPC; when done correctly, you can send your object as a Parcel and changes to the data are reflected back.
You could use it for an edit screen, for example. Say you have a details view of an item, and you click "edit". If you operate directly on the parcelled object, the changes should be immediate on the previous view as well.
Whether or not you should do that depends on lots of things. It's an easy way to introduce subtle bugs as you're eg. formatting something in another view and mutate the state (eg. change between metric and imperial units or between relative and absolute scales) and then wonder why it changed it on another view too.
View all comments
Show parent comment
22
u/Foxtrot56 Sep 16 '18
Don't forget that these agnostic standards, ideas and frameworks change every 6 months.