这是要发生的事情:
java - 由于某种原因,当我编写getparams时,它没有执行应做的工作吗?-LMLPHP

而当您只编写“ getpar”时,它意味着可以提供以下选项:
java - 由于某种原因,当我编写getparams时,它没有执行应做的工作吗?-LMLPHP

但是对我来说
java - 由于某种原因,当我编写getparams时,它没有执行应做的工作吗?-LMLPHP

什么都没发生

并抛出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函数吗?是公开的还是受保护的?我对继承的知识不再那么有用,但是我记得私有函数存在问题。

如您所见,这是您的代码

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/

10-09 12:59