Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Get data from web service
1. Acquire data in a repository class
Check the Respository Here
2. Share data with LiveData objects
The ViewModel is simply passing that LiveData object back to the user interface.
And the fragment, that is the user interface,
is only responsible for managing the presentation
3. Network permissions and status
4. Add Retrofit and coroutine dependencies
view models and data, coroutines and retrofit2
5. Define a Retrofit interface
Add the keyword suspend.
That means that this function is designed to be called from with a coroutine.
Coroutines can run either on the UI thread or in a background thread, but for a function to be part of a coroutine call, it must have the suspend keyword at the beginning of the function declaration.
6. Retrieve remote data with Retrofit