标签:blog http io ar 使用 sp java on 数据
学习Gson的几个用法
基本:
http://blog.csdn.net/onlyonecoder/article/details/16907713
更多:
http://blog.csdn.net/lk_blog/article/details/7685169
使用的方法
Status status = new Status(); status.setToken(token); status.setX(x); status.setY(y); status.setIndex(index); status.setPagesize(pagesize); status.setDistance(distance); String jsonQueryStatus = new Gson().toJson(status); HttpUtils http = new HttpUtils(); RequestParams params = new RequestParams(); try { params.setBodyEntity(new StringEntity(jsonQueryStatus, "utf-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } http.send(HttpRequest.HttpMethod.GET, HttpGetUrl.QueryStatus(), params, new RequestCallBack<Str
success:[{"id":155,"userid":"63","imageurl":[null],"smallimageurl":null,"content":"","x":40.041325,"y":116.288383,"up":0,"down":0,"commentnum":0,"time":"2014-11-10T15:56:07.000Z","distance":4528},
{"id":154,"userid":"63","imageurl":[null],"smallimageurl":null,"content":"","x":40.041325,"y":116.288383,"up":0,"down":0,"commentnum":0,"time":"2014-11-10T15:55:47.000Z","distance":4528},
{"id":150,"userid":"63","imageurl":[],"smallimageurl":null,"content":"","x":40.041302,"y":116.288406,"up":0,"down":0,"commentnum":0,"time":"2014-11-06T15:33:38.000Z","distance":4525},
{"id":149,"userid":"63","imageurl":[{"small":"http://storage.jcloud.com/picthumb/5e283ccb-e9de-415a-b00c-d05265ce9bb5--avorcachebitmap.png?Expires=3562771397&AccessKey=6f9cfed255534762839f4635e37aa680&Signature=LYRjnCvWKro1QXM52NmMdOjnkJE%3D","url":"http://storage.jcloud.com/b1name/f8db72e6-2d74-4817-8b99-703a44af8851--avorcachebitmap.png?Expires=3562771397&AccessKey=6f9cfed255534762839f4635e37aa680&Signature=8VsUIH6%2BGGjfSdLWqNbR2NpnH3U%3D"}],"smallimageurl":null,"content":"","x":40.041302,"y":116.288406,"up":0,"down":0,"commentnum":0,"time":"2014-11-06T15:29:10.000Z","distance":4525},
{"id":148,"userid":"54","imageurl":[{"small":"http://storage.jcloud.com/picthumb/f748764e-3ff7-42db-85fe-1b82fab88b2b--avorcachebitmap.png?Expires=3562688469&AccessKey=6f9cfed255534762839f4635e37aa680&Signature=noymAXVm1Io%2FxjmJy34bRY%2FEJhw%3D","url":"http://storage.jcloud.com/b1name/b680ba68-0c07-4d1f-9fc0-0fdc4a4d2a8a--avorcachebitmap.png?Expires=3562688469&AccessKey=6f9cfed255534762839f4635e37aa680&Signature=UsWZZKJFFn67FC7%2F7nLIoBBE1XQ%3D"}],"smallimageurl":null,"content":"","x":40.00758,"y":116.3265,"up":0,"down":0,"commentnum":0,"time":"2014-11-05T16:27:03.000Z","distance":31},
{"id":147,"userid":"54","imageurl":[{"small":"http://storage.jcloud.com/picthumb/ed10bf56-8707-4df7-be5c-f16fe71d2ed0--avorcachebitmap.png?Expires=3562688466&AccessKey=6f9cfed255534762839f4635e37aa680&Signature=BmolkdvYQW1OTKVC91M2W3OzzRA%3D","url":"http://storage.jcloud.com/b1name/81c04dd9-ac9d-48ca-a717-2a9179a3710b--avorcachebitmap.png?Expires=3562688466&AccessKey=6f9cfed255534762839f4635e37aa680&Signature=T1FDPcn9KscfYbk9%2F8JEyBkvT08%3D"}],"smallimageurl":null,"content":"","x":40.00758,"y":116.3265,"up":0,"down":0,"commentnum":0,"time":"2014-11-05T16:26:59.000Z","distance":31},{"id":146,"userid":"63","imageurl":[],"smallimageurl":null,"content":"","x":40.041321,"y":116.288414,"up":0,"down":0,"commentnum":0,"time":"2014-11-05T14:47:34.000Z","distance":4525},{"id":145,"userid":"63","imageurl":[null],"smallimageurl":null,"content":"","x":40.041325,"y":116.288445,"up":0,"down":0,"commentnum":0,"time":"2014-11-01T11:42:01.000Z","distance":4522},{"id":144,"userid":"63","imageurl":[null],"smallimageurl":null,"content":"","x":40.04134,"y":116.288445,"up":0,"down":0,"commentnum":0,"time":"2014-11-01T11:38:58.000Z","distance":4522},{"id":143,"userid":"63","imageurl":[null],"smallimageurl":null,"content":"","x":40.04134,"y":116.288445,"up":0,"down":0,"commentnum":0,"time":"2014-11-01T11:38:51.000Z","distance":4522}]
上面的是json 再转换成List
List<Status> statusList = new Gson().fromJson( responseInfo.result, new TypeToken<List<Status>>() { }.getType() );
标签:blog http io ar 使用 sp java on 数据
原文地址:http://www.cnblogs.com/chuiyuan/p/4132930.html