android - Deference of 'response.body()' may produce 'java.lang.NullPointerException -


this question has answer here:

i have error. name value string type. settext string type have 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

your advice important me

it's warning not error, prevent use

if (response.body != null ) {} 

or use annotation @ header of method @nonnull

denotes parameter, field or method return value can never null.

public void onresponse(@nonnull call<placeholdermodel> call, response<placeholdermodel> response) { 

link


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -