Answer the question
In order to leave comments, you need to log in
How to change response messages?
Hello!
At the moment, if the request is sent, then the server response looks like the content of the html document to which I directly send the request (I don’t need to).
I can’t quite understand what needs to be changed in the code so that the message “Successful” is displayed on a successful operation, and “Error” on any other.
My MainActivity code:
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(MainActivity.this, response.trim(), Toast.LENGTH_SHORT).show();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(MainActivity.this, error.toString(), Toast.LENGTH_SHORT).show();
}
}){
@Override
protected Map<String, String> getParams() {
Map<String,String> params = new HashMap<String, String>();
params.put("count_id",s);
return params;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
requestQueue.add(stringRequest);
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question