MVVM in Android- Model View View Model Tutorial with Project

  Рет қаралды 16,937

tutorialsEU - Android

tutorialsEU - Android

Күн бұрын

What is MVVM and how do I use it in Android?
By the way, check out our Android Developer Learning path: bit.ly/3l6vG86
In this video, we talk about what Mvvm is and why you might want to use it. We also show some of the benefits of using Mvvm for your app architecture.
This is a second part to networking with retrofit where we are going to be introducing the Model View ViewModel Architecture which is an architecture recommended by google for developing android applications.
For those who might not understand generally what *Architecture patterns* are ****in android, they are patterns introduced to help developers properly structure project codes and separate core logic from the Activities or Fragment especially in large or real mobile applications that might require feature changes while it grows as it is very helpful in the maintenance of the project while adding and removing features. The most popularly used architectures on android are
MVC - Model View Controller
MVP - Model View Presenter
MVVM -Model View ViewModel
We will be discussing MVVM
MVVM encourages separation of concern and in this case making sure that the business logic is entirely separated from the view. You can take the business logic to be the logic that controls the main features of the app and view it to be the user interface elements that allow the user to interact with the app.
Model - The model comprises of the Repository and the ApiService
View - The view is the MainActivity
ViewModel - The ViewModel is the MainViewModel
Creating the Repository class
The repository class is usually the single source of truth (SSOT)in a project, for instance, if you are going to be depending on two data sources say an API and a local database then this class serves as a mediator between the two sources and knows where to get the data from so that the viewmodel is solely responsible for making the data available for the view to observe.
The ViewModel Class
Before you use the ViewModel class you have to add these dependencies to your project. Open build.gradle and add the following dependencies.
tutorialsEU offers you free video tutorials about programming and development for complete beginners up to experienced programmers.
This includes C#, Unity, Python, Android, Kotlin, Machine Learning, etc.
Stay tuned and subscribe to tutorialsEU: goo.gl/rBFh3x

Пікірлер: 17
@tutorialsEU
@tutorialsEU 3 жыл бұрын
Btw, here you will find part one: kzbin.info/www/bejne/qWLNonZtZdqCbbM
@kevinmathenge1397
@kevinmathenge1397 2 жыл бұрын
I've been really struggling with this. Thanks a ton for the in-depth explanation and really easy to follow tutorial.
@tutorialsEU
@tutorialsEU 3 жыл бұрын
Wow, this video needs more views :P
@OmerFarukUcer
@OmerFarukUcer 2 жыл бұрын
I can't understand some codes in the video.What should I do for learn their usage?Or how can I learn that easily?
@MichaelJohnson-ze6ql
@MichaelJohnson-ze6ql 2 жыл бұрын
having an issue around 20:20 where the MainAdapter when passed characters as an argument is still red. Not sure why
@ewomer100
@ewomer100 2 жыл бұрын
Any way to show how to do this with Jetpack Compose?
@joshross7757
@joshross7757 2 жыл бұрын
You're a gem 🙂
@thaboncube6991
@thaboncube6991 2 жыл бұрын
Thanks for the tutorial
@electroe2143
@electroe2143 2 жыл бұрын
thank for this great useful video.
@tutorialsEUAndroid
@tutorialsEUAndroid 2 жыл бұрын
Glad it was helpful!
@mouhamedmokhtaroubaya5277
@mouhamedmokhtaroubaya5277 2 жыл бұрын
i have this error : Cannot create an instance of class ViewModel
@LifelinesStories786
@LifelinesStories786 2 ай бұрын
great i wish ur courses were free on udemy😅
@mysticmanish5002
@mysticmanish5002 3 жыл бұрын
hi sir can you make the video on advanced fitness app in kotlin ....plz make that course and i will make sure that i m the first student to buy that course.
@FarooqAhmad-lr1fx
@FarooqAhmad-lr1fx 2 жыл бұрын
nice
@hassanammer7854
@hassanammer7854 2 жыл бұрын
This is not true tutorial it's just copy and paste 😑
ViewModels & Configuration Changes - Android Basics 2023
18:46
Philipp Lackner
Рет қаралды 123 М.
«Кім тапқыр?» бағдарламасы
00:16
Balapan TV
Рет қаралды 266 М.
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 45 МЛН
规则,在门里生存,出来~死亡
00:33
落魄的王子
Рет қаралды 31 МЛН
Android MVVM | ViewModel + LiveData | And example app
28:19
Catalin tech
Рет қаралды 19 М.
Model View View-Model (MVVM): Getting Started
29:12
CodingWithMitch
Рет қаралды 398 М.
ViewModel Explained - Android Architecture Component | Tutorial
8:27
MVVM in Android Studio using Kotlin | Android Knowledge
17:12
Android Knowledge
Рет қаралды 8 М.
Kotlin Singleton Example with MVVM and Coroutines
36:24
CodingWithMitch
Рет қаралды 56 М.
What is the MVVM pattern, What benefits does MVVM have?
22:38
James Montemagno
Рет қаралды 99 М.
«Кім тапқыр?» бағдарламасы
00:16
Balapan TV
Рет қаралды 266 М.