1、首先输入代码
public void SendBy>
new Thread(new Runnable() {
@Override
public void run() {
try {
>
>
List<NameValuePair> params=new ArrayList<NameValuePair>();//将id和pw装入list
paramsadd(new BasicNameValuePair("ID",id));
paramsadd(new BasicNameValuePair("PW",pw));
final UrlEncodedFormEntity entity=new UrlEncodedFormEntity(params,"utf-8");//以UTF-8格式发送
>
>
if(>
2、然后再输入下方的代码:
{
>
String response=EntityUtilstoString(entity1, "utf-8");//以UTF-8格式解析
Message message=new Message();
messagewhat=USER_LOGIN;
messageobj=response;
handlersendMessage(message);使用Message传递消息给线程
}
}
catch (Exception e) {
eprintStackTrace();
}
}
})start();
}3、最终,测试结果图,如下:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)