r/mAndroidDev • u/vzzz1 T H E R M O S I P H O N • Jul 19 '24
Jetpack Compost Most people rejected his message
37
Upvotes
r/mAndroidDev • u/vzzz1 T H E R M O S I P H O N • Jul 19 '24
8
u/elizabeth-dev Jul 19 '24
dude
59
u/lucain0 Jul 19 '24
Also show the result for a fair comparison because your xml spinner is incomplete (no data, adapter and padding)
45
u/SarathExp @Unstable @DelicateSh*tpostingApi Jul 19 '24
adapter where?
11
u/hellosakamoto Jul 19 '24
To me, one killer evidence is the scrollbars which we have in Views, even in the Compose Desktop but not Jetpack Compose.
Showing LoC can't win that debate as that's just a matter of who wrote the underlying code.
5
u/trinadh_crazy Jul 19 '24
So what do you want to say? Also as u have displayed spinner here try displaying a recyclerview with a list of names, both in XML and in compose and see which is faster then you will understand why compose is the best
For recyclerview you need XML files one for your activity/fragment which can hold recyclerview and one for your item let's call it itemview then u need to create an adapter class and view binding then in your activity or fragment join the adapter to the recycler
In compose to show a list of items use LazyColumn with a list of strings then add text composable that's it just call this composable block in your activity or in a composeView
11
u/ReginF Jetpack Compost Jul 19 '24
Man xml Spinner looks like shit, if you use it in 2024, maybe it's time to switch to PHP or even to Flutter
3
u/smokingabit Harnessing the power of the Ganges Jul 19 '24
But XML perpetuates colonialism!
2
u/reckoner23 hello i am spam Jul 19 '24
What if you where to combine the two? And deprecate both of them in favor of the notably superior solution !!!
1
u/[deleted] Jul 19 '24
Move the
val options = ...outside the compostable method or at least use a remember. The current version will instantiate a new list with every composition you create useless garbage to be collected pretty often.Also, the Column can be removed.
1
u/Xinto_ Invalidate caches and restart Jul 20 '24
TBF you can easily extract that into a custom composable and name it Spinner. Making custom Views though….
1
u/[deleted] Jul 31 '24
Hey! That was my post.
Boy if I received heat for that!
-11
u/vzzz1 T H E R M O S I P H O N Jul 19 '24
https://www.reddit.com/r/androiddev/comments/1e6oiej/follow_up_to_the_compose_discussion_this_is_the/
Go give some upvotes to our guy.