I am using Retroft and GSON for parsing the response.
My onResponse
code is like below
@Override
public void onResponse(@NonNull Call<ResultList> call, @NonNull Response<ResultList> response) {
if (response.isSuccessful()) {
if (response.body() != null && response.body().getSuccess() == 1) {
................
I am checking response.body() != null
and also response.isSuccessful()
.
Still I am getting warning in Android studio on line response.body().getSuccess()
.
How to avoid this warning?
I am using retrofit:2.3.0 and gson:2.8.1. I already tried the solution on this question (Retrofit Method invocation may produce 'java.lang.NullPointerException' ). But it was not working