我暂时了解的几种服务器端与客户端的传值方式:
myeclipse:直接传
out.println(updateUsersAll);
android:直接判断result
————————————————————————————
myeclipse:传实体类型:
JSONObject users=JSONObject.fromObject(u); out.println(users.toString());
android: 解析成实体类型:
Gson gson=new Gson(); Users u=gson.fromJson(result, Users.class);
————————————————————————————
myeclipse:传list:
JSONArray array=JSONArray.fromObject(classifyFoodTypeList); out.println(array.toString());
android:解析成list:
Gson gson=new Gson(); ArrayList<GuodouActivity> list=gson.fromJson(arg0, new TypeToken<ArrayList<GuodouActivity>>(){}.getType());
时间: 2024-10-14 10:29:25