Reputation: 152
What is the difference betweeen string()
and toString()
for Retrofit Response ?
Can any tell the difference in details.
response.body().string();
response.body().toString();
Upvotes: 1
Views: 392
Reputation: 101
response.body().toString();
- Convert object responseBody(body()) to string
return getClass().getName() + "@" + Integer.toHexString(hashCode());
response.body().string();
- Convert response from server to string;
Upvotes: 0
Reputation: 1260
.toString():
This returns your object in string format.
.string():
This returns your response.
Upvotes: 0
Reputation: 1275
response.body().string();
returns response body converted to String. JSON, for example.
response.body().toString();
returns string look of ResponseBody object. It hash, class ...
Upvotes: 4