I want to handle and show some message in onErrorResponse
below is my code.
String url = MainActivity.strHostUrl+\"api/delete_picture\";
Read more about Volley Error handling at Android Volley example with Error Handling
Every Volley requests has two callbacks -one for success and one for failure.Based on the type of VolleyError parameter in the onErrorResponse callback developers can show a sensible message to the users as shown below
@Override
public void onErrorResponse (VolleyError error){
if (error instanceof TimeoutError || error instanceof NoConnectionError) {
//This indicates that the reuest has either time out or there is no connection
} else if (error instanceof AuthFailureError) {
// Error indicating that there was an Authentication Failure while performing the request
} else if (error instanceof ServerError) {
//Indicates that the server responded with a error response
} else if (error instanceof NetworkError) {
//Indicates that there was network error while performing the request
} else if (error instanceof ParseError) {
// Indicates that the server response could not be parsed
}
}