The ViewModel & LiveData Tutorial in Android Studio (Kotlin)

  Рет қаралды 42,885

Indently

Indently

Күн бұрын

In this video I'll be creating avery easy increment app using a viewmodel with livedata, and this should cover the very basics and give you a general understanding on how you can use a viewmodel along with livedata.
def lifecycle_version = "2.2.0"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
​​​​

Пікірлер: 52
@arpitgupta3151
@arpitgupta3151 4 жыл бұрын
Simplest way to explain it Don't get discouraged by less views bro Your tutorials are easy to learn and very helpful
@youshaarif4253
@youshaarif4253 Жыл бұрын
This is exactly what I was looking for. Simple, concise and to the point
@karateswe
@karateswe 3 жыл бұрын
Simple. And very powerful. One good and simple example is worth more than 1 billion words!
@Indently
@Indently 3 жыл бұрын
Hey karateswe, I really appreciate the kind words. Hope to see you around the channel more often!
@palaksdarji
@palaksdarji 3 жыл бұрын
One possible change. Its better to put that business logic where you increment the number in the viewModel. Its not View's job to work on logic. It just has to call viewModel's method to update the count.
@knalliebar
@knalliebar 2 жыл бұрын
I have to say, when teaching about the use of viewmodel and why, this is by far one of the most important things. This validates a redo in my opinion.
@lifeOfCharlesMaina
@lifeOfCharlesMaina 3 жыл бұрын
Bro ...this is the best explanation I have come around... please make more tutorials such as this...
@VIKASROYv
@VIKASROYv 4 жыл бұрын
Wow man loved it, you made it very simple.
@jatinvashisht4293
@jatinvashisht4293 3 жыл бұрын
best explanation I have seen ever. Great work
@AwesomeDevNotes
@AwesomeDevNotes 4 жыл бұрын
I can see the future when you do Dagger Hilt, MVVM, Testing, Coroutines, Retrofit, Room, WorkManager, Navigation in one app! It's coming together 🧘
@Indently
@Indently 4 жыл бұрын
Eventually I'm sure we will get there. But that sounds like it's going to require a major amount of planning aha
@kirwakelvinkering3122
@kirwakelvinkering3122 Жыл бұрын
Woww ,this tutorial made things simple for me .thank you .
@potavios
@potavios 2 жыл бұрын
Great video! Simple and direct to the point!
@rma1563
@rma1563 3 жыл бұрын
no bullshitting no like subscribe comment, straight to point. very clear and precise. subscribed 🧡. wanna see more android stuff though
@chewataapp7021
@chewataapp7021 3 жыл бұрын
I wish it was possible to subscribe 1 million times.
@Indently
@Indently 3 жыл бұрын
Thanks mate, just sharing my content with your friends is more than enough
@Codecxter
@Codecxter 2 жыл бұрын
Love you 😘 after many videos i found the right one
@faboxbkn
@faboxbkn Жыл бұрын
Thank you very much!! very helpful!
@alperencevlik3104
@alperencevlik3104 3 жыл бұрын
This video very helpful to me. Thank you man
@giocornejo2222
@giocornejo2222 2 жыл бұрын
Thank you so much. I was coding wrong my whole life 🤣
@emanalsbeiheen5619
@emanalsbeiheen5619 3 жыл бұрын
Very helpful and understandable... Thx
@iftak01
@iftak01 3 жыл бұрын
Amazing video bud, simple and good explanation. Make a big project as well lol
@WW-qv8uw
@WW-qv8uw 2 жыл бұрын
Simple and well explained, thank you
@f.uckeng
@f.uckeng 2 жыл бұрын
just the best bro
@farnadtohidkhah9448
@farnadtohidkhah9448 3 жыл бұрын
Hi, Thanks for useful video regarding The ViewModel & LiveData Tutorial in Android Studio (Kotlin). I saw in the video that without defining the Button in the activity (like val btn_button=this.findViewById(R.id.btn_button) as Button) you were using directly the button id of the layout. How you did that because Android Studio gets error of this syntax
@fser2987
@fser2987 3 жыл бұрын
Hi, probably used plugins which is id "kotlin-android-extensions". you can add in grandle file this extensions
@lixoten344
@lixoten344 2 жыл бұрын
Did you ever figured out how he did it? lol
@iftak01
@iftak01 3 жыл бұрын
Amazing video bud, thanks
@darwingsanchez5328
@darwingsanchez5328 3 жыл бұрын
Dude, I loved this video, help me a lot, I have a question, I just want to do the same thing but I want it increment the number itself like automatically. I tried to put the fun in a for and even in a do, while but didn't work... Do u understand? Thanks brother. You're amazing
@Indently
@Indently 3 жыл бұрын
I'm happy you like, I think you should look into flows since that the most modern way of doing what it sounds like you're trying to do.
@darwingsanchez5328
@darwingsanchez5328 3 жыл бұрын
@@Indently Yeah, I have been looking for flows, thank you man
@chriscampbell5901
@chriscampbell5901 3 жыл бұрын
Great vid, thanks!
@hilaltube4693
@hilaltube4693 3 жыл бұрын
Very good but getting an error cannot create an instance of class ViewModel
@chewataapp7021
@chewataapp7021 3 жыл бұрын
My hero!
@cybergorilla
@cybergorilla 3 жыл бұрын
Well said, bro! Great job! :В
@vladyslav.kushnir
@vladyslav.kushnir 3 жыл бұрын
Hi, bro!
@vladyslav.kushnir
@vladyslav.kushnir 3 жыл бұрын
Where are you from?
@SertuncSELEN
@SertuncSELEN 3 жыл бұрын
you are very nice talking
@monik1070
@monik1070 3 жыл бұрын
You showed really great tutorial , but I have a question , how did you use TextView and button without even initialising them , please let me know
@Indently
@Indently 3 жыл бұрын
Kotlin synthetics
@rupeshmandal1
@rupeshmandal1 4 жыл бұрын
Hello sir, can we make video player app like MxPlayer. Show video folder by folder in recyclerView. Please♥️
@lyawileh.a8741
@lyawileh.a8741 3 жыл бұрын
Cool.
@StarkIndustries2008
@StarkIndustries2008 2 жыл бұрын
How to remove the observer ?
@nihadildarov
@nihadildarov 10 ай бұрын
Thanks
@SrichakradharReddyNagireddy
@SrichakradharReddyNagireddy 2 жыл бұрын
So, if I don't use an observer on the view model and just do setText on the textview in the button click listener, will the textview get reset after rotation?
@kamilboryczka7117
@kamilboryczka7117 4 жыл бұрын
Maybe you will record something about a Room with multiple tables?
@Indently
@Indently 4 жыл бұрын
Hopefully in the near future!
@sarrieri
@sarrieri 2 жыл бұрын
Hello kind people, I have a stupid question, I was following this tutorial with the exception of defining my dependencies in the gradle script but somehow the project still works. Same goes for RecyclerView. Can somebody help me understand ?
@hanguyenxuan2843
@hanguyenxuan2843 3 жыл бұрын
observer was deleted in new update .
@lixoten344
@lixoten344 2 жыл бұрын
Well, did not work for me. i checked and checked..... Someone below asked you....am I am wondering the same "I saw in the video that without defining the Button in the activity (like val btn_button=this.findViewById(R.id.btn_button) as Button) you were using directly the button id of the layout. How you did that because Android Studio gets error of this syntax"
ViewModels & Configuration Changes - Android Basics 2023
18:46
Philipp Lackner
Рет қаралды 121 М.
когда не обедаешь в школе // EVA mash
00:57
EVA mash
Рет қаралды 3,8 МЛН
А ВЫ ЛЮБИТЕ ШКОЛУ?? #shorts
00:20
Паша Осадчий
Рет қаралды 9 МЛН
pumpkins #shorts
00:39
Mr DegrEE
Рет қаралды 57 МЛН
ViewModel in Android Studio using Kotlin | Android Knowledge
13:07
Android Knowledge
Рет қаралды 4,4 М.
LiveData Explained - Android Architecture Component | Tutorial
12:12
10 Crazy Python Operators That I Rarely Use
11:37
Indently
Рет қаралды 22 М.
Android MVVM | ViewModel + LiveData | And example app
28:19
Catalin tech
Рет қаралды 19 М.
RecyclerView | Everything You Need to Know
25:07
Practical Coding
Рет қаралды 137 М.
ViewModel Explained - Android Architecture Component | Tutorial
8:27
NSURLProtocol: How I Stole an App For My Wedding
56:25
Bryce Bostwick
Рет қаралды 39 М.
Android ViewBinding in 8 Minutes
8:59
Philipp Lackner
Рет қаралды 76 М.
Learn Python OOP in under 20 Minutes
18:32
Indently
Рет қаралды 43 М.
когда не обедаешь в школе // EVA mash
00:57
EVA mash
Рет қаралды 3,8 МЛН