-1
HttpAsyncRequest request = new HttpAsyncRequest(
                               MapsActivity.this, 
                               Constant.BaseUrl, 
                               HttpAsyncRequest.RequestType.GET, 
                               new MarkerParser(), listener);
request.addParam("array",arr);  //this is not working
request.execute();

I want to send arraylist of latlng to the server i am using http request but we can only send string through that . How to send arraylist of latlng ?

Heshan Sandeepa
  • 3,388
  • 2
  • 35
  • 45

2 Answers2

0

this is how i passed my arraylist of latlng to JSONARRAY and then converted into string and then i sent to server.

JSONArray pointsinjsonarray=new JSONArray();

                    for(int i=0;i<arraylistofmarkers.size();i++) {
                        try {
                            pointsinjsonarray.put(i,arraylistofmarkers.get(i));

                        } catch (JSONException e) {
                            e.printStackTrace();
                        }

pointsinjsonarray.toString();

0

I don't know where you are getting that class (maybe it is your own...), as I stated in my comments. In the docs it says that you should do the following:

RequestParams params = new RequestParams();
params.put("array", arr);
AsyncHttpClient client = new AsyncHttpClient();
//listener is an instance of AsyncHttpResponseHandler
client.get(Constant.BaseUrl, listener, params);

Source: http://loopj.com/android-async-http/

Matias Olocco
  • 509
  • 4
  • 9