Answers for "how to convert errorBody to pojo in retrofit"

0

how to convert errorBody to pojo in retrofit

if (response.isSuccessful()) {
    // Do your success stuff...

} else {
    APIError message = new Gson().fromJson(response.errorBody().charStream(), APIError.class);
    Toast.makeText(MainActivity.this, "" + message.getMessage(), Toast.LENGTH_SHORT).show();
}
Posted by: Guest on May-08-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language