How to Make a CRUD Todo List App - Full MVVM Beginner Guide - Android Studio Tutorial
Вставка
- Опубліковано 28 гру 2021
- MVVM is the architecture for Android. It's recommended by Google and I use it in all of my apps, no matter how big they are.
This course will cover everything you need to know and give you a great template you can use to build your very own well-scaling apps using the MVVM architecture. And all that up-to-date, so you're ready to build your favorite apps with Jetpack Compose in 2022.
MVVM in 100 seconds:
• MVVM in 100 Seconds
Kotlin Playlist:
• KOTLIN NEWBIE TO PRO
Jetpack Compose Playlist:
• Jetpack Compose
⭐ Get certificates for your future job
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become a professional Android developer now:
pl-coding.com/premium-courses...
💻 Let me personally review your code and provide individual feedback, so it won't backfire and cost you a fortune in future:
elopage.com/s/philipplackner/...
Subscribe to my FREE newsletter for regular Android, Kotlin & Architecture advice!
pl-coding.com/newsletter
Join this channel to get access to perks:
/ @philipplackner
Get the source code for this video here:
github.com/philipplackner/MVV...
Regular live codings on Twitch:
/ philipplackner
Join my Discord server:
/ discord
Regular programming advice on my Instagram page: / _philipplackner_
Checkout my GitHub: github.com/philipplackner
You like my free content? Here you can buy me a coffee:
www.buymeacoffee.com/philippl...
8:08 DAO
12:56 DB
14:30 Repository purpose
15:50 Repository - why should you depend on abstraction
17:20 Repository implementation
19:10 DI
19:27 what is DI in short
23:14 @Installin annotation meaning
27:18 ViewModel
28:17 VM purpose
33:26 SharedFlow and Channels
35:15 Channels
1:07:02 SavedStateHandle
1:29:37 Recap
iam i the only one that dosent understand iam just writing
can anyone suggest any other way to learn mvvm
@@abedalraoufzeidan1461 I look at a clip in the video and then try to write it my own, also writing your own projects
@@abedalraoufzeidan1461 What helped me is taking a few days and implementing a very simple in-memory database (just an interface + class implementation). When you do that you can mess around with the database where you can add to it, remove from it (these are functions that just add/remove from a mutable list stored in the class that implements the interface mentioned before). Then you can make a simple to-do list app without using flows, view models, dependency injection and a room database. What you'll quickly notice is that while you can make an app in such a way, actually scaling it or working with it in general after the initial prototype quickly becomes messy.
After you do all you will gain some very valuable insights on why MVVM and what problems it solves.
Personally, I am here because I took that approach in the prototyping phase of my app and failed miserably in integrating view models to my database interface. It's doable but a lot of my problems seem to be magically solved by MVVM, I love it.
Gotta give it to this guy! Keeps pushing out these long format, well researched and really helpful videos consistently. Thanks a lot for these.
Glad they help! 🙏
@@PhilippLackner it is very helpful
Hello Phillip.Your ability to simplify complex concepts and explain them in a clear and concise manner is truly commendable. Your step-by-step approach to teaching makes it seem easy and achievable, even for beginners.
Looking forward to learning more about Firebase, CRUD operations, and authentication. If you have time for a UA-cam tutorial on these topics, I'd love to watch it. Thanks for sharing your expertise.
Great video, thanks for taking your time to put all this together.
Cheers from Belgrade!
So clear to understand what to do for mvvm with jetpack compose, thanks a lot~
Beautiful exposition of the MVVM architecture, grateful to you for this video.
Best tutorial for beginner you explain every step and I really appretiate that most ppl just go straight forward like type machines and they call it beginner friendly
The Events for the screens, it was amazing, we can reuse everything, with kotlin and jetpack Compose. Of course not forgetting about the HILT, it does a beautiful job. Thanks for the class. God bless you
woahh cool. you are very clear to explain , I never touch the design pattern but after watching this I laugh what I code . your code so clean and readable thanks!
This is the most complicated ToDo app in any technology that I've seen. Good lord!
Thanks for this tutorial Philipp! I enjoyed learning so much about android app development and your recap at the end as well. Keep up the great work, you are an inspiration for so many of us
Thanks frank, glad you enjoyed it!
Liked the video and my takeaway was Events Handling - Events flows from the UI to the ViewModel and State Flows back to the UI from the ViewModel. There was also that bit of using optional query parameter in the Navigation route that I wasn't aware of. There is always something to learn on each video you do for beginners and veterans alike.
Glad it helps!! :)
You deserve 1 Millon like 😊
Thank you Philipp .. Amazing guidance as usual.. 👍
I follow all your videos, they are extremaly helpfull.
Thank you Philipp. The video is very useful for me.❤️
Thank you son much Philip. I'm glad I really came across your channel and I haven't looked back. I really appreciate your contents. Not like I'm deserving of it, but I would love to see you make a video on an e-commerce app for both customer and merchant, implementing payment methods too. Thanks once again. 😊
You are gr8 my friend always keep going up thank you a lot from bottom of my heart
Great tutorial.. Clearing all doubts
Awesome tutorial.. love the ‘live coding’ vibes..
I don't know how to describe you , but you are AMAZING !!!
amazing tutorial... thanks big time 🤩😄
Du bist Gold wert!!!
Hi,
Thanks for the video. It helps me a lot.
Wow finally! Thanks
Happy new year Philipp!
This may be your best overview video so far. Thanks!
Wow, thanks!
FWIW, I am making a presentation about Coroutines and Compose for my coworkers and I linked to several of your videos and playlists.
Thank you so much from Brazil.
Ah all i need in one video thanks a lot
Amazing video! Could you make a video on how to migrate a big project step for step to compose, where you should start etc.?
ur a legend, this video is very helpful
Thanks brother ✨
I can't thank you enough ❤️❤️
cool, updated practice for Android development.
Good job, thank you
I really appreciate your videos. Kindly make a habit of providing more room for coding by pressing Enter Key to give more room for viewers to see the above code and understand it as you go on. I have always found myself making small pauses and pressing back-key to read a previous code.
YAY I managed to finish it! This tutorial is a real gem, it covers so many concepts of Kotlin and Jetpack Compose that are demonstrated in action right away. Thanks a lot Philipp!
The next step is to use this project as a template for a different CRUD app.
The most challenging part was to fix dependency errors at the very beginning, since some of the versions are deprecated. Quick advise, instead of importing the intial project from git, create a new one and revise the dependencies one by one, setting more up to date versions or completely refactoring them. For example, kapt is no longer supported, instead you should use ksp.
moving kapt to ksp is not working , I did all from official docs. Does gradle version matter
@@adityakumdale6300 I hope u managed to solve it, u actually need to apply the jetbrain plugin on both the root and app gradle builds. It worked for me that way
@@chax255 can you please elaborate it a bit. I am stuck here resolving the dependencies
Great 👏
It's so useful and interesting
Hi man, thanks for the tutorial. The thing is I'm new to android and I believe the best way to learn is to start with the basics and I was wondering if it's possible to build an app like this one without using mvvm. If yes can you please make one for us for it will help us understand the importance of using mvvm architecture. Thanks in advance
Happy new year bro
OMG you are a genius
this is an extremely underrated youtube channel. you should be famous.
Thanks❤️
Much appreciated man. Also I've been struggling to intergrate graphQl with Kotlin but in vain. Is it really supported in Kotlin? What's your thought?
I like this video about MVVM architecht, also I learned my english
Thank you
@Philipp Lackner
Could you please make a video for room migration using the same project. it would be great help
@3:23 setting up the project is really difficult because i have to search on stack overflow what to do like changing compileSDK to 32 and deleting the line composeOptions in the gradle.build app (module)
First of all, great content!! Love your videos a lot!!
Second, on Hilt, why do I have to annotate the module with SingleComponent and the method with Singleton? I got confused what's the reason to use both annotations.
SingletonComponent = Defines the lifetime of the dependencies (live as long as the app)
Singleton = Defines the scope. Here it means there will only be a single instance of your dependency that's reused
Thank you for this video. It gave me a much needed real app architecture insight.
The outdated dependencies were a pain though, especially the ones related to dagger hilt and the new dsl for declaring dependencies.
Still, after hours of racking my head and searching online, I was able to follow along with the code and built the app. So again, thank you.
Do you have the updated dependencies for dagger hilt ? If so, could you kindly share them? I've really struggled to find the updated ones.
Or better yet, could you share your project's github link please
Hey, Currently I am going through same problem. Can you provide the solution to it
@@JonJon-po6xt Did you fix the issue?
Great talk, I always love your videos. I have a query. Why is the repository instance annotated as a singleton in the Hilt AppModule?
Because we only need a single instance of it during the whole app's lifetime
Great
Hi, I've got a question about the coroutines Channel. Is it a solution that you would use in a big scale production app or is it more suited for smaller projects? In bigger apps there would be tons of events, so my concern is that it would become tiring to keep track of them. Also about navigation-compose, have you had any problems while using it, have you considered using compose for views with fragments for navigation?
What's the concern you have about apps with more events exactly?
I like the way you teach, All the topics can be understood easily, I would like to purchase some of your courses but I see those are a bit expensive, If you try to keep them at affordable prices, It will help most of the developers to improve their skills.
Thank you..!
Thanks glad you like my free stuff! The courses might look pricy, but if you consider what you get out of it, it's a joke honestly. For example my most recent course teaches you so many important industry level skills and really helps to become job ready. It's a one time investment and you'll get the skills for a job in the quickest time possible, I think that's a good deal.
And of course somehow i need to be able to maintain making all these free videos
We need a video of how to take pictures and upload to firebase storaage lol, no where on the internet can I find a simple well explained video or tutorial. Its crazy.
Hello Teacher what IDE you are using to teacg us Android Development? I think it's Intellijidea?
What a coincidence 😄🤣
I yesterday finished making a todo app
厉害厉害
bro, does business logic includes setOnclickListener interface?
if we want to implement it we write the code inside another class right?
and then instantiate it inside main activity
Great Tutorial Philipp. I wanted to know if there was an easy way of installing the dependencies through Android Studio instead of typing then explicitly. I notice my Android Studio always tells me I can do that from the Project Structure. Thanks!
Also, I noticed that you get a similar project directory setup if you use the "Empty Composer" option during project creation.
Hello may I ask something? Why do we use Kotlin Flow here instead of live data? Assuming they both listen to any changes within our list.
Can you do a full modular mvvm with hilt please ?
Nice tutorial - i've spend the last few days following along, and copying your code. I was not able to find this code in your github repo?
Please correct me if I am wrong, but aren't we almost following an MVI architecture by making use of Events, and having a giant 'when' clause in the TodoViewModel at 42:40?
nice
A bug I found with this app is when you deleted a todo item and attempt to create a new one, the navigation does not happen until the snackbar as disappeared. If you continuously tap the + button it will navigate more than once so when you finish creating your todo item and tap save it does not go back to the todo list
Was great up to 33:26, where it got very complicated. Is there a simpler way to proceed from that point onwards?
I have a question. We could just take the insert etc methods from dao without making all these classes and use them however we want right?
How do you use the string resources in the viewModel ?
Hello. Maybe i dont understand ?
But is there a way to get only the start project ( not the entire source code for the finished project) So that i Can code along with the project ?
Can you maby do an example with a more complex room Database that has more Tables and relations? Would be nice :D And Great VIdeo btw ;D
Check this playlist: ua-cam.com/play/PLQkwcJG4YTCS3AD2C-yWtJUGTYMh5h3Zz.html
hi Philipp please make tutorial about kotlin multiplatform and make your complete archive more complete😅
UiEvent and specific screen event (e.g TodoListEvent) is kinda confusing, especially when a project grows bigger, what I understand is events such as TodoListEvent holds "state' of the UI that persist values (such as for screen rotations), while UiEvents are one-time events only, why is then the FAB button action/event included in the TodoListEvent if its only 1 time per se?
please make an video on UIEvent
Why don't you have mapper class [Entity to Object, and vice versa] for this project?
daggerhilt vs koin which to use
What about MVVM implementation over Compose Desktop?
Hi Philipp, What's difference b/w this and Note application which you already built earlier?
This is a Todo app here, not a note app. But yeah, difference is that here I focus on plain MVVM while the other one focuses on clean architecture on top of MVVM
Why are use cases not returning flows but repository ?
Greatly appreciated! Could you also make a video about how clean architecture, dagger Hilt and mvvm are structured and used in a real multi-module app, not only a single module app?
I'm working on a bigger course about multi-module architecture since this big topic shouldn't just be handled in a single video :)
@@PhilippLackner oh God!! thanks! I bought your canvas and doodlekong courses and they are making my holidays! Keep up the good work you're doing maestro! stay blessed!
@ thanks a lot for the support and glad you like them!
@@PhilippLackner this is much needed, your testing playlist is very comprehensive, great work. and if I may also suggest, If you get time could you add how to use firebase emulators and write unit tests for firebase functionality. Thank you
@@PhilippLackner Your first video on DI for Hilt is easily the best one on youtube. I've watched many of them but yours is explained the best.
Why the TodoRepository interface doesn't extend the TodoDao interface?
Nice expo. Stuck in dependency hell with Dagger-Hilt though. Seems to me like the versions of Dagger-Hilt, Kotlin compiler and gradle just cannot agree with each other. :)
can u help me please
Thank you so much bro
Hello, Philipp Lackner I want you to make video with work manger in android.
Philipp could you please make a video about Paging3/RemoteMediator? I'm struggling to understanding API + Caching inside RemoteMediator.
Check the channel The Android factory and playlist rick and moti course , It has content of paging 3 !! it will help !!
I have completed the code as u did but got a big problem while debugging my app in gradle build for room and hilt configuration someone help me resolve
There's a problem, If I press a lot of times the save button on the AddEditTodoScreen with the title textfield empty, then I put a title, then If I press again the save button I need to wait all snackbars to finish for returning in the TodoListScreen
The viewmodel has dependencies, you require a factory for the viewmodel to pass arguments, how does he circumnagivate this requirement in this project tutorial
Hey Phillip could you create videos on uncovered APIs in Kotlin language.
What do you mean
Just brilliant, what about the same but using API and Ktor?
Take it as homework :)
Can anyone tell in 47:11 how event.todo is valid?Like event is of the type TodoListEvent.
Why we had used UIEvent to call PopBackstack instead of calling the method directly in UI. Now when user click it will call ViewModel method set event -> trigger UIEvent channel -> call the callback (PopBackstack)? Does this wont create complexity
is this architechture a clean architecture or only its just a MVVM
Excellent, thank you. But I can't inject the view model, I am getting unresolved reference for the hiltviewmodel() method
did you find a solution?
@@chaitany.a you need to add
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0'
in your build.gradle file. That helped me
there is a bug on the app, how to fix it,
the bug is when you delete a todo then after that you tap or click the add floating action button, it will not perform the desired action until snackbar disappears and when you tap it repeatedly you will have so many AddEditTodoScreen, how to fix it?
Does this UiEvent class influenced from MVI reducer or its just me whos find similarities?
yeah it's similar, but somehow the UI needs to be able to receive events from the VM
❤️
Hey man I really like the font that you use in your android studio. What's the font name ?
Source code pro
@@PhilippLackner thanks
Don't you think it would be better to have the repository interface extend the dao rather than copying the dao's methods over to the repository... 👍 btw, great work, I passed a pair programming interview by doing exactly what was in your tutorials... 👌
@@_th3j4ck4l interface ToDoRepository : TodoDao and ToDoRepositoryImpl : TodoRepository ... In the end ToDoRepositoryImpl has to implement all the methods in the dao... You avoid having to copy and paste functions when you make changes in the dao.
I think your argument of "incorrect use of the repository pattern" is wrong because the ToDoRepositoryImpl can still extend other interfaces that get data from other sources and even have its own unique methods.
Bottomline here is avoid copy and paste where you can.
Oh i see the slack app there.