3

I have a error. name is value string type. setText is string type but i have a error.

enter image description here

     Factory.getInstance().placeHolderModel().enqueue(new Callback<PlaceHolderModel>() {
        @Override
        public void onResponse(Call<PlaceHolderModel> call, Response<PlaceHolderModel> response) {
            textView.setText(response.body().name);
        }

Thank you very much

Your advice important for me

Yavuz
  • 129
  • 1
  • 3
  • 17

1 Answers1

0

it's just a warning not an error, to prevent that use

if (response.body != null ) {}

or use annotation at the header of your method @NonNull

Denotes that a parameter, field or method return value can never be null.

public void onResponse(@NonNull Call<PlaceHolderModel> call, Response<PlaceHolderModel> response) {

link

Oussema Aroua
  • 5,225
  • 1
  • 24
  • 44