In the previous part we created blank fragments. We can navigate between them using the navigation architecture component library. In this tutorial, we will add some actual functionality to this Forecast MVVM app, namely the ability to fetch weather from an API.
This means that in this part you are going to learn how to use Retrofit together with Gson to fetch and parse JSON data from an API. The API we are going to use is Apixu which is a weather API offering a generous free plan. You can apply what you learn here to any other API you desire so should there be any problems with Apixu in the future, you will be able to switch to a different API very easily.
?Get the code from this tutorial?
I followed your tutorial to the last, but i’m having a problem now when i run the app: java.lang.NullPointerException: Attempt to invoke virtual method ‘int com.resocoder.forecastmvvm.data.db.entity.CurrentWeatherEntry.getId()’ on a null object reference
at com.resocoder.forecastmvvm.data.db.CurrentWeatherDao_Impl$1.bind(CurrentWeatherDao_Impl.java:38)
what causes that?
Because this API service is down
Ok. Does it mean its a bit tricky to start studying the tutorials?
Maybe a little. The api he uses in the video is deprecated, has a new version, but changes some parameters, just pay attention while studying the tutorial.
New Api link:
https://weatherstack.com/
Yeah the api service was deprecated. But mentor explained such understandable that i have modified it in my company’s project . Thank you so much