什么也没发生
它抛出一个 AuthFailureError
package com.name.name;
import com.android.volley.AuthFailureError;
import com.android.volley.Response;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
/**
* Created by p on 17/06/2016.
*/
public class RegisterRequest extends StringRequest {
private static final String REGISTER_REQUEST_URL = "http://name.comli.com/Register.php";
private Map<String, String> params;
public RegisterRequest(String name, String username, int age, String password, Response.Listener<String> listener) throws AuthFailureError {
super(Method.POST, REGISTER_REQUEST_URL, listener, null);
params = new HashMap<>();
params.put("name", name);
params.put("username", username);
params.put("password", password);
params.put("age", age+ "");
getparams
谢谢您并帮助我们解决此错误。=)
最佳答案
看起来您正在构造函数中输入它。尝试从构造函数中输入它?我真的不知道你想做什么。对我来说,它看起来像是有一个功能,在下一张图片中,该功能突然消失了,但有一个自动完成功能。
那么你确定你的父类有 getParams 函数吗?它是公开的还是 protected ?我对继承的了解不再那么丰富,但我记得在私有(private)函数方面遇到了问题。
如您所见,这是您的代码
public RegisterRequest(String name, String username, int age, String password, Response.Listener<String> listener) throws AuthFailureError {
....
getparams
但是支架永远不会关闭!所以试试这个:
public RegisterRequest(String name, String username, int age, String password, Response.Listener<String> listener) throws AuthFailureError {
super(Method.POST, REGISTER_REQUEST_URL, listener, null);
params = new HashMap<>();
params.put("name", name);
params.put("username", username);
params.put("password", password);
params.put("age", age+ "");
}
然后输入 getparams。我不知道它是否有效,但至少你有一个封闭的构造函数。
关于java - 由于某种原因,当我编写 getparams 时,它没有执行它应该执行的操作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37895260/