When i'm making a request and it fails, it shows the Toast with a full response error, I just want the "message" from it and not the whole JSON.
I want to make the message only appear and not the whole JSON String.
This is my JSON String:
{"status":false,"message":"message here"}
This is the onResponse function:
@Override
public void onResponse(String response){
try {
JSONObject volleyResponse = new JSONObject(response);
boolean success = volleyResponse.getBoolean("success");
final String message = volleyResponse.getString("message");
if(success){
messageText.setText("success");
}
} catch(JSONException e) {
Toast.makeText(Authentication.this, response, Toast.LENGTH_LONG).show();
}
}