i have three array list and i need to send it from servlet to android device....I have searched the similar problem here but i could not understand how do i retrieve all three Array List seperately. Here is servlet code:
.....
ArrayList<String> List1 = new ArrayList<String>();
ArrayList<String> List2 = new ArrayList<String>();
ArrayList<String> List3 = new ArrayList<String>();
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
list1.add("item1.1");
list1.add("item1.2");
list1.add("item1.3");
list2.add("item2.1");
list2.add("item2.2");
list2.add("item2.3");
list3.add("item3.1");
list3.add("item3.2");
list3.add("item3.3");
String json1 = new Gson().toJson(list1);
String json2 = new Gson().toJson(list2);
String json3 = new Gson().toJson(list3);
res.setContentType("application/json");
res.setCharacterEncoding("UTF-8");
res.getWriter().write(json1);
res.getWriter().write(json2);
res.getWriter().write(json3);
}
Now please help me to show android side coding....or give some hint or link. Thanks.