https://kotlinlang.org logo
#compose
Title
# compose
v

vesp

10/20/2023, 7:58 PM
Are there good example projects available on github that I can use to look at for reference? I'm a little hung up on the fact that if there should be multiple ComponentActivity or just one
p

Pablichjenkov

10/20/2023, 8:06 PM
Example of what Jetpack Compose? Thousands on GitHub, from templates to fully functional Apps. You gotta have good searching skill in GitHub I agree, their search engine is really bad at matching good results. But give it a try.
v

vesp

10/20/2023, 8:08 PM
@Pablichjenkov Yes, Jetpack compose
p

Pablichjenkov

10/20/2023, 8:10 PM
There are a lot of example projects there. I don't have one in my mind that I could recommend right now but I have seen plenty. Check it out
s

Stylianos Gakis

10/20/2023, 8:11 PM
if there should be multiple ComponentActivity or just one
Do you mean Activities in general, or
ComponentActivity
in particular?
p

Pablichjenkov

10/20/2023, 8:11 PM
You can have one Activity per feature module if you don't want to mess up too much with navigation compose
But in theory one Activity is enough, in practicality you end up having a couple of them.
s

Stylianos Gakis

10/20/2023, 8:12 PM
https://github.com/android/nowinandroid is always a safe bet for an app which showcases a bunch of the things you can do with compose. And if the question was about activities in general, I would really not recommend going with more than 1 activity, especially if it’s not an already existing app.
👆 1
☝🏻 1
v

vesp

10/20/2023, 8:14 PM
Not activities in general, just
ComponentActivity
in particular. Ill check out that repo, @Stylianos Gakis
s

Stylianos Gakis

10/20/2023, 8:15 PM
Alright, what do you mean then by “multiple ComponentActivity”?
v

vesp

10/20/2023, 8:17 PM
androidx.activity.ComponentActivity
I was wondering if there had to be a separate activity for things like
Login
,
Shop
, etc where you have to call
setContent
in
onCreate
s

Stylianos Gakis

10/20/2023, 8:17 PM
Alright, then it has nothing to do with
ComponentActivity
in particular (say, as opposed to
AppCompatActivity
or something like that), your question is generally about using more than one activity in the app or not. In which case my suggestion is this still https://kotlinlang.slack.com/archives/CJLTWPH7S/p1697832767648939?thread_ts=1697831895.067199&cid=CJLTWPH7S
👆 1
https://developer.android.com/guide/navigation Here is your entry-point regarding how to use androidx.navigation. It currently can be a bit confusing regarding if you want to use compose-only, or with fragments, where the docs are still mostly referencing the fragment approach (but not everywhere) so if you do get confused a bit along the way it would not necessarily be all your fault.
👍🏽 1