user8919158
user8919158

Reputation:

How to add list into params of volley Android?

Please help me how can i add a list in param of volley android like this

@Override
        protected Map<String, String> getParams() throws AuthFailureError {
            Map<String, String> params = new HashMap<>();
            params.put("UGUID", UGUID);
            params.put("INAME", list);
            return params;
        }

It is working for sample string but its not work for list of string

Upvotes: 1

Views: 467

Answers (2)

Hemanth S
Hemanth S

Reputation: 688

Try like this

@Override protected Map<String, Object> getParams() throws AuthFailureError {
    Map<String, Object> params = new HashMap<>();
    params.put("UGUID", UGUID);
    params.put("INAME", list);
    params.put("ARRAY_NAME",yourarray);
    return params;
}

Upvotes: 1

Mohit Hooda
Mohit Hooda

Reputation: 273

if you want to send list to server you can create a json array and convert it to string and send it to server

@Override
        protected Map<String, String> getParams() throws AuthFailureError {
            Map<String, String> params = new HashMap<>();
            params.put("UGUID", UGUID);
            params.put("INAME", list);
            params.put("your_key_d_for_array",yourarray.tostring());
            return params;
        }

Upvotes: 0

Related Questions