Closed fadi-botros closed 5 years ago
Thanks Fadi for you comment, really I need someone review what I do and evaluate it
I know that I should use live data, but I wanted to talk about LiveData in the next branch.
I promise that I will use it in the next branch.
Check it now on LiveData branch
Good work, keep up 👍 👍 But
https://github.com/NohaSamir/PopularMovies/blob/421590e7a4234fb40a6e4f87d775b5501d131c6f/app/src/main/java/com/example/android/popularmovies/view_model/MainViewModel.java#L41
Using MVVM architecture and using
ViewModel
, means using observation instead of listener interfaces. An automatic observation mechanism is already provided by Google on Android calledLiveData
, you can use it, or you can use RxJava.Then use
setValue
on the main thread, instead of invoking the listener, this would make the observation more automatic.I think there is also something maybe more automatic, is to use
MutableLiveData<List<MutableLiveData<Movie>>>
, so that you can observe on a single Movie when you are binding aRecyclerView
's view holder