Volley does not call getParams for my custom request?

前端 未结 3 1065
不知归路
不知归路 2020-12-15 13:07

Please, does Volley automatically add my GET params to the URL? For me it\'s not working so and also when looking into sources, I just cant find any call of the getParams me

3条回答
  •  轮回少年
    2020-12-15 13:55

    Try this,

    public class LoginRequest extends Request {
    
        // ... other methods go here
    
        private Map mParams;
    
        public LoginRequest(String param1, String param2, Listener listener, ErrorListener errorListener) {
            super(Method.POST, "http://test.url", errorListener);
            mListener = listener;
            mParams.put("paramOne", param1);
            mParams.put("paramTwo", param2);
    
        }
    
        @Override
        public Map getParams() {
            return mParams;
        }
    }
    

    See this example also,

    https://github.com/evancharlton/folly/

提交回复
热议问题