In noble future when compose is released, activiti...
# compose
g
In noble future when compose is released, activities, fragments, views will be annotated with
@Deprecated
?
👍 1
🚫 1
😆 3
f
I think those things will be treated like Java. While we all feel Java is deprecated, people can still use it because that’s what they know/have/like.
l
And
@Composable
could be used with
@GenerateView
(which is not implemented yet) to generate a
View
subclass which you then can use in your
.xml
file
So I don’t think they will deprecated core components of Android
m
I can't imagine that Activity will be deprecated, if new UI shall work on old devices with existing framework. Activity is one thing that probably can't be replaced. It's base thing that works with Window, needed for UI.
f
Compose doesn’t use activities afaik
👌 1
l
Well, in
Compose
the
Activity
is used as a starting point for
setContent
, but
setContent
itself doesn’t use the
Activity
, as you said it used
Window
So, if you can provide the
Window
without using the
Activity
the
Activity
could become not necessary anymore
m
And this is I think not possible. Android won't show Window for an app without Activity. Also, does compose offer lifecycle events that we know from Activity: onResume, onStart, onCreate, etc?
l
No, it has its own lifecycle callbacks
onCommit
,
onActive
,
onDispose
@Michal Bacik maybe the
Application
can provide the
Window
🙂
g
I understand that activity is base element in android. I mean that we will not use activity directly.
It will be under compose hood
l
hmm, I don’t think so 🙂 read the link I posted above
p
It is always convenient to have an entry point for system events. At the end, an Activity is a common sink from some sensors and configuration changes. So leaving it wouldn't hurt. Now Fragments, they are strong candidates to be outs. In fact they are already out.
m
Also note that Compose will allow to be integrated gradually - maybe only for some views, or for all UI in existing Activity which will still use activity lifecycle. It's not expected that we'll rewrite apps completely just because compose arrives.
👍 2
p
It should. I hope one day Android adopts kind of a micro-service oriented strategy, where inserting a new service don't need to touch existing ones. As of now, every Google IO, Android Summit has become basically a nightmare for devs. After the event you just realize how much code you have to migrate. 🧌
a
The
Activity
will still exist, the idea behind expressing one as a single
@Composable
function with some additional annotation is indeed that you would not manually write an
Activity
subclass and we would treat it as abstracted boilerplate.
💯 2