Добрый день люди, я пользуюсь Android Volley, версия 1.1.1. Проект выполняется быстро, когда это GET-запрос, но как только я добавляю params и превращаю его в POST-запрос (как во всех примерах, которые я нашел во всем Интернете), он не хочет запускаться и выдает мне три ошибки:
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.
Вот мой POST-код
//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);