RegisterActivity中的网络部分

这里要用到http ,json,等。

token就是令牌,比如你授权(登录)一个程序时,他就是个依据,判断你是否已经授权该软件

学习gson.参考 

http://www.cnblogs.com/lichenwei/p/3987429.html

常用的两个方法:

Gson.toJson(Object src) //将对象进行json序列化

Gson.fromJson(String json,Class<T>) //将json字符串反序列化成对象

JSON

http://hybxiaodao.iteye.com/blog/1107651

JSONObject 和Gson

http://blog.csdn.net/android2me/article/details/8349369

http://www.cnblogs.com/smyhvae/p/4063452.html(好)

JSONObject有很多optXXX方法,比如optBoolean, optString, optInt...

他们的意思是,如果这个jsonObject有这个属性,则返回这个属性,否则返回一个默认值

http学习

 1.android网络连接之httpURLConnection和 HttpClient

http://www.cnblogs.com/devinzhang/archive/2012/01/17/2325092.html

2.可以参考之java http json

http://www.cnblogs.com/zghull/p/3335564.html

http://www.cnblogs.com/aiguozhe/p/3900608.html

3.

http://www.cnblogs.com/ws5861/p/3569220.html

StringEntity学习

//两个构造方法
StringEntity(String s) 
StringEntity(String s, String charset) 
public StringEntity(String s,
                    String charset)
             throws UnsupportedEncodingException

public StringEntity(String s)
             throws UnsupportedEncodingException
 

 注册成功结果:

 

说明得到的不是电话号码,和之前 想的不同。

参考:

http://blog.csdn.net/jianghuiquan/article/details/8641116

如果用户已经存在,则

User registerUser() response中得到{"status":"fail","info":"用户名已存在"}

 

 

posted @ 2014-10-30 22:08  chuiyuan  阅读(390)  评论(0编辑  收藏  举报