[Solved] Retrofit give null pointer exception
When you have an error on your response, your response body is null. You have to use the code from the Response and if you want to get the data from the error use the errorBody(): public void onResponse(Call<SalaryListModel> call, Response<SalaryListModel> response) { if (response.isSuccessful()) { Log.e(TAG, “onResponse: calling”); if (response.body().getStatus_code() == 200) { Log.e(TAG, … Read more