Search code examples
androidsequenceloopjhttp-request-parameters

AsyncHttpClient RequestParams not follow sequence


My Code as below with call post method:

RequestParams reqParams = new RequestParams();  
    reqParams.put("name", title);
    reqParams.put("date", date);
    reqParams.put("description", description);
    reqParams.put("status", status);
File file = new File(image);
    reqParams.put("image", file);

When i check the reqParams it return

status=active&description=test&name=D&date=2017-01-01&image=/storage/file/1.png.

Is it possible to return follow by sequence with my parameter like start with

name=D&date=2017-01-01&description=test&status=active&image=/storage/file/1.png.

Thanks in advance!


Solution

  • try to putt them in a hashmap and then add into params as described in their documentation

    Map<String, String> map = new HashMap<String, String>();
     map.put("first_name", "James");
     map.put("last_name", "Smith");
     params.put("user", map); // url params: "user[first_name]=James&user[last_name]=Smith"
    

    for further reference and guide you may follow the docs here