Good day people, I'm using Android Volley, version 1.1.1. The project runs swiftly when it's a GET request but as soon as I add the params and turn it to a POST request (like in all the examples I found all over the internet) it does not want to run and gives me three errors:
error no. 1" There is no applicable constructor to '(into, java.lang.String, com.vm.okone.MainActivity.(anonymous),com.vm.okone.MainActivity.(anonymous))', error no. 2 " method onResponse does not override method from its superclass, error no. 3 " method onErrorResponse does not override method from its superclass.
Here is my POST code
//TextView
final TextView mTextView = (TextView)findViewById(R.id.serverResp);
// Instantiate the RequestQueue.
RequestQueue queue = Volley.newRequestQueue(MainActivity.this);
//url
String url = "http://127.0.0.1:8080/index.jsp";
StringRequest stringRequest = new StringRequest(Request.Method.POST, url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
// Display the response string.
mTextView.setText(response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
mTextView.setText("That didn't work!");
}
}) {
//adding parameters to the request
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<>();
params.put("name", "asdf");
params.put("email", "qwerty");
return params;
}
};
// Add the request to the RequestQueue.
queue.add(stringRequest);