Creating a Todo App with Jetpack Compose & MVVM: A Beginner's Guide

preview_player
Показать описание
Hello, guys in this jetpack compose tutorial we are going to create a simple jetpack compose app (Todo App) using MVVM architecture with state flow in android studio.

Timestamps
00:00 introduction
00:54 Project setup
01:26 Room database setup
4:42 Repository
7:42 dependency graph
10:30 Viewmodel setup
23:36 Composable Screens
38:40 Jetpack compose Navigation

Links

project
Рекомендации по теме
Комментарии
Автор

after exploring for one hour your's is the most suitable

alifmallik
Автор

This tutorial is very helpful to learn Jetpack compose. Thank you very much.

vickywick
Автор

Nice tutorial i just wanted to find out where is the database connected to

okotelemma
Автор

very good video !! However can you details more why the DetailViewModelFactory is necessary ? What is the benefit from it ? Have seen no other tuts that implement it. Aso why not such a factory in the Home screen ? Thks

yoyo-
Автор

Hi, got another question concerning the state of the HomeScreen. From Detail screen, you are clicking the "Save" button, which only call the insert repository via the view model of detail screen. Then the OnNavigate to navigate back to the home screen. But how then the list from the home screen is refreshed ? How the state of the home screen, that contains the list of todo, is refreshed so that the home screen is recomposed ? Is it Room that is sending an "event" to the application when inserting a data ? And this event is somewhere catched by the state of the homescreen ? Or, there is a kind of "onFocus" event when the homescreen is displayed after navigating back to it from the detail screen, navigation that recomposes the home screen and/or re-apply the INIT functions ? This is quite confusing here

yoyo-
Автор

brow how did you got those templates is there any plugin available?

GulshanKumar-redn
Автор

Just learning Native App development now after doing Web Dev. Great tutorial but I have to say the state of Android development is still very backward and badly organised, there is no proper organisation, no proper frameworks, too much boiler plate code to write every time. Its better than XML views I learnt first, but still too complex.

In the Room Database for example, why so many classes? One Interface should be enough, DataSource, Dao, Database, too many things. Why do we need this? Just seems very awkward, complex & unnecessary
I thought a repository and and interface should be enough

But the tutorial is great, thank you

TheMyth.
Автор

Nice tutorial, thanks! For some reason, if I click on an existing TodoItem item in the HomeScreen menu, the DetailScreen menu for the new item opens - the Todo and Time fields are not filled, the button is displayed as Save Todo. Although the text of the current Todo element should be filled and the caption on the button should be Update Todo. Only I have an error?

stanislavrevo
Автор

can someone please help me understand how he generated the code for the database by just typing db?

samdroid
Автор

Hi, guys In this tutorial we have an error when navigating from the Home screen to the Detail screen thanks to Stanislav Revo for Pointing out this error, it occurred because we forgot to initialize at 19:49 the id variable in the DetailViewModel. to fix this error you have to initialize the id variable in the first init block viewModelScope.launch {

// add this code
selectId.value = id
combine(todoText, todoTime, selectId) { text, time, id ->
DetailViewState(text, time, id)
}.collect {
_state.value = it
}
}

Happy Coding.

HoodLabs