Is there any alternative to send request parameters through android other than NameValuePair
. I'm trying to send arraylist as request parameter, but NameValuePair
accepts only string value.
Asked
Active
Viewed 2,816 times
2

Anil M
- 1,297
- 2
- 19
- 42
-
1add more details including code you have written till now. – Piyush-Ask Any Difference Apr 25 '13 at 08:00
3 Answers
2
You may consider sending the ArrayList as JSONArray.
Check this SO post.
convert ArrayList<MyCustomClass> to JSONArray
Convert normal Java Array or ArrayList to Json Array in android

Community
- 1
- 1

appsroxcom
- 2,821
- 13
- 17
0
read about JSONObject, JSONArray .. you can convert it to string with toString method and then bring it back to JSONObject, JSONArray passing this String constructor if you receive it from server.
Generally its a standard way of passing complex structures.

AndroidGecko
- 14,034
- 3
- 35
- 49
0
Store arraylist in to a string and then send it..
ArrayList<String> contactlist=new ArrayList<String>();
contactlist.add("Android");
contactlist.add("tarnaka");
contactlist.add("uppal");
contactlist.add("Prasad");
String[] contact=new String[contactlist.size()];
contact=contactlist.toArray(contact);

Adi
- 13
- 4