14

After searching about android architecture components I realized that MVVM is better than other architectures at some points so I started to learn MVVM and I'm using Kotlin language but the problem is when I search for tutorials to start learning I found many components like RxJava, RxAndroid, Dagger2, Room, Lifecycle and etc. but they don't say why they are using them and why they choose some specific components. i will show you some examples :

1- Android MVVM with Dagger2, Retrofit, RxJava

2- Android MVVM with Dagger2, Retrofit, RxAndroid

3- Android app with MVVM dagger2 RxJava Livedata and Room

My questions are :

1- How should I decide to choose some of these components and work with them?

2- How should I know that I need to use some of them together(for example Livedata and RxJava)?

This is really confusing for me and I don't know how to start.

Community
  • 1
  • 1
houman.sanati
  • 1,054
  • 3
  • 18
  • 34
  • 2
    Follow [the tutorial](https://codelabs.developers.google.com/codelabs/build-app-with-arch-components/index.html?index=..%2F..index#0), and ignore RxJava until you need to execute asynchronous requests in such a way that you ***need*** the Rx operators to express what you want, instead of some MediatorLiveData ;) – EpicPandaForce Feb 07 '19 at 00:00

4 Answers4

9

First you need to individually understand why to use Kotlin, MVVM, Dagger, RxJava, Retrofit.

MVVM and Kotlin:

https://medium.com/@zhangqichuan/android-development-with-mvvm-and-kotlin-9598c3623ce1

RxJava and RxAndroid:

RxAndroid is an extension to RxJava(Used for handling threads and asynchronous tasks), for more details check following links: Difference between RxJava and RxAndroid? https://www.quora.com/What-is-the-difference-between-Retrofit-and-RxJava-RxAndroid

Retrofit:

https://medium.com/@elye.project/kotlin-and-retrofit-2-tutorial-with-working-codes-333a4422a890

LiveData and room with kotlin:

Room is a database layer on top of an SQLite database which used to remove boilter plate while fetching data from local sqlite database, use following links: https://codelabs.developers.google.com/codelabs/android-room-with-a-view-kotlin/#0

After understanding this components(Kotlin, MVVM, Dagger, RxJava and RxAndroid, Retrofit, LiveData) individually then you need to do all this things in single project, use following link:

https://github.com/egek92/Kotlin-MVVM-LiveData-Room

Sushant Poman
  • 375
  • 2
  • 9
3

As a jr. android developer, i was thinking like you but i choose a route like :

  • Learn MVVM with ViewModel(AAC),LiveData,Observable pattern.
  • Make your async and multi threading processes with Coroutines.
  • Make your Dependency Injection with Koin.

(If you want you can see how to mix them. Koin will be added soon. https://github.com/furkanaskin/CoinStalker)

Future?

Dagger 2, maybe Rxjava etc..

faskN
  • 704
  • 5
  • 4
2

If you know the Core Android basics and has done at least 1 or 2 projects then you can jump to this, https://android.jlelse.eu/why-to-choose-mvvm-over-mvp-android-architecture-33c0f2de5516

abhi.nalavade
  • 196
  • 3
  • 10
2

Maybe what you need is start from basics. There are a couple of google official code labs about Android architecture.

You can start looking at this code lab and then the others.

https://codelabs.developers.google.com/codelabs/kotlin-android-training-view-model

FJCG
  • 1,017
  • 7
  • 6