mcxiaoke / android-volley

DEPRECATED
4.29k stars 1.56k forks source link

Different type data to passing on params volley #170

Closed 4sskick closed 7 years ago

4sskick commented 7 years ago

Hi, I've been walking around looking for an answer. I need to passing arrayList and string at the same time as parameter with method POST. Like you know for passing parameter in body as parameter we have to define it inside getparams method like below example

@Override
            protected Map<String, String> getParams() throws AuthFailureError {
                HashMap<String, String> params = new HashMap<>();
                params.put("validator", "afe13Rg78#*Agy");
                params.put("userId", String.valueOf(GlobalFunction.getCurrentUserId()));
                params.put("token", GlobalFunction.getCurrentToken());

                return params;
            }

how can I passing arraylist and string for a parameter body at the same time?

emreturgut commented 7 years ago
@Override
            protected Map getParams() throws AuthFailureError {
                HashMap params = new HashMap<>();
                params.put("validator", "afe13Rg78#*Agy");
                params.put("userId", String.valueOf(GlobalFunction.getCurrentUserId()));
                params.put("token", GlobalFunction.getCurrentToken());

                return params;
            }

you can write like this

4sskick commented 7 years ago

great! thank you for your solution, it works to me