How to fix a NullPointerException in the response okhttp?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
37 views
Immediately sorry for the stupid question, how to fix warning of NullPointerException in this line of code
responseString = response.body().string();

.string() - Method invocation 'string' may produce 'java.lang.NullPointerException
by | 37 views

1 Answer

0 like 0 dislike
Keep body in a variable and check for null.
by
110,608 questions
257,186 answers
0 comments
38,663 users