Closed Lalitv7 closed 6 years ago
the body() method can be consumed only once . This maybe the reason of NullPointerException
That's only true for OkHttp. It's a cached object in Retrofit.
That being said, it's impossible to know what's null here, but it's likely the views are absent or something in your model is deserializing as null. It's definitely not clear that it's a Retrofit problem. If it is, we'd need a self contained test case or executable sample demonstrating that is was. What you've provided is complicated and cannot be run to validate behavior.
On Mon, Nov 27, 2017, 7:19 AM Rookie notifications@github.com wrote:
the body() method can be consumed only once . This maybe the reason of NullPointerException
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/square/retrofit/issues/2574#issuecomment-347165757, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEWNJwL721ag6J_V1Cbo2TMEO1mXuks5s6qjcgaJpZM4QrSH4 .
I want to fatch data from restcountries api. MainActivity
CountriesInfo: getters and setter
RetrofiApi Interface : HTTP requests
Activity_main.xml
I am getting java.lang.NullPointerException in com.example.sony.finalsubmission.MainActivity$1.onResponse(MainActivity.java:53)