Hi everyone, I’ve attached a dummy screenshot just...
# compose
s
Hi everyone, I’ve attached a dummy screenshot just to provide context. The original Figma design is different, but it has the same bottom navigation bar with 4 items: Home, Search, My Library, and Premium. In traditional XML, based Android development, we usually use a BaseActivity with Fragments like
HomeFragment
,
SearchFragment
,
LibraryFragment
, and
PremiumFragment
. Then, based on the requirement, we add additional activities or fragments. My question is about Jetpack Compose: 1. Do we follow the same approach in Compose? 2. If not, what is the recommended way to structure the app? Should we use a single
MainActivity
with composable screens like
HomeScreen
,
SearchScreen
,
LibraryScreen
, and
PremiumScreen
? If anyone has built a similar app using Jetpack Compose from scratch (with API integration), I would really appreciate it if you could share any YouTube playlists or tutorials that helped you. Thanks in advance, This is a bit urgent for me, so any guidance is really appreciated 🙏 #C0B8MA7FA, #C01Q62JMKBP, #C0B8M7BUY
u
In Jetpack Compose, the recommended approach is to use a single MainActivity that hosts all your screens as composable functions rather than using multiple Fragments. Use the Navigation Compose library to set up a NavHost inside a Scaffold with a bottom navigation bar. Each composable screen (e.g., HomeScreen, SearchScreen, LibraryScreen, PremiumScreen) can have its own ViewModel for handling business logic and API calls. This streamlined, single-activity architecture keeps your code clean and leverages Compose’s declarative UI model.
🙌 1
k
👍 1
s
@Ujjwal Sai Thanks a lot for replying and taking the time to help out, If I have any doubts or need more clarification, I’ll reach out again 🙏🏼 @Konstantin Tskhovrebov Thanks a lot for sharing the GitHub link! 🙌 I’ll check it out.
👋 1
Just waiting to see if others share more details or approaches. 🙌