不得不说,JSON 格式的确是非常美妙的,速度快而且简化了很多操作
在 Android 下,Android SDK 已经为我们封装好了整个与 JSON 有关的操作,使用非常方便

以下就是一个标准的 JSON 请求的实现过程:

[java] view plain copy print ?
  1. HttpPostrequest=newHttpPost(url);
  2. //先封装一个JSON对象
  3. JSONObjectparam=newJSONObject();
  4. param.put("name","rarnu");
  5. param.put("password","123456");
  6. //绑定到请求Entry
  7. StringEntityse=newStringEntity(param.toString());
  8. request.setEntity(se);
  9. //发送请求
  10. HttpResponsehttpResponse=newDefaultHttpClient().execute(request);
  11. //得到应答的字符串,这也是一个JSON格式保存的数据
  12. StringretSrc=EntityUtils.toString(httpResponse.getEntity());
  13. //生成JSON对象
  14. JSONObjectresult=newJSONObject(retSrc);
  15. Stringtoken=result.get("token");

android下支持JSON的远程访问(推荐此BLOG):http://marshal.easymorse.com/archives/1707

关于android JSON写入类--JsonWriter,轻松生成JSON格式的数据:http://disanji.net/2011/03/05/android-3-0-json-jsonwriter/

android JSON解析示例代码,每日维基widget:http://www.android123.com.cn/androidkaifa/664.html

客户端向服务器端发送数据,一种是在url中带参数,一种是json数据发送方式(小陌):http://henzil.easymorse.com/?p=241

android访问PHP取回JSON数据:http://blog.lrenwang.com/post/114/

如何用android JSON对象发送一个请求:

http://cn.webdiscussion.info/question/3027066/如何发送一个请求在与Android-JSON对象

更多相关文章

  1. mybatisplus的坑 insert标签insert into select无参数问题的解决
  2. python起点网月票榜字体反爬案例
  3. Android关于短信加密
  4. Android(安卓)传输数据时Base64编码算法详解
  5. Android(安卓)SQLite数据库 《第一行代码》
  6. [置顶] Android中数据存储的5种方法
  7. Android(安卓)webview与js交换JSON对象数据示例
  8. BootChart在Android中使用
  9. Android周学习Step By Step(6)--Android的数据库SQLite

随机推荐

  1. android闹钟――原代码
  2. Android 中文 API (22) ―― MultiAutoComp
  3. 教你配置安卓开发环境!(附带开发通讯教程)
  4. Android——打包篇:Android(安卓)Studio将
  5. Android获取前台进程包名
  6. Android-缓存数据保存-通用方法
  7. 如何在Android下使用JNI
  8. nginx -s reload ?失败了
  9. 在Android中通过Java修改文件权限
  10. AndroidStudio中gradle异常:unexpected en