Android app to fetch movie details for a given query
Please refer to the following posts describing the code in details:
- Getting started with android app architecture components like LiveData and viewmodel
- Getting started with android app architecture components with dagger2
The app demonstrates the usage of MVVM architecture pattern using android architecture component library and LiveData and Repository pattern, inspired from Google recommended architecture pattern from I/O 17 .
ViewModel provides the data for a specific UI component, such as a fragment or activity, and handles the communication with the business part of data handling, such as calling other components to load the data or forwarding user modifications. The ViewModel does not know about the View and is not affected by configuration changes such as recreating an activity due to rotation.
LiveData is an observable data holder. It lets the components in your app observe LiveData objects for changes without creating explicit and rigid dependency paths between them. LiveData also respects the lifecycle state of your app components (activities, fragments, services) and does the right thing to prevent object leaking so that your app does not consume more memory.
Repository modules are responsible for handling data operations. They provide a clean API to the rest of the app. They know where to get the data from and what API calls to make when data is updated.