写了一个android登陆论坛的程序 但是怎么都登陆不上去 到底问题是什么呢 郁闷呐 List <NameValuePair> params = new ArrayList <NameValuePair>();
params.add(new BasicNameValuePair("username",UserName));
params.add(new BasicNameValuePair("password", Password));
String sourceString = Net.getInstance().post("http://zhixing.bjtu.edu.cn/member.php?mod=logging&action=login", params); Net.getInstance().post函数是这样的 public String post(String URL,List <NameValuePair> params) throws Exception
{
String resultString;
try {
HttpPost httpRequest = new HttpPost(URL);
// httpRequest.setEntity(new UrlEncodedFormEntity(params, "GB2312"));
httpRequest.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));
HttpResponse httpResponse = client.execute(httpRequest);
if(httpResponse.getStatusLine().getStatusCode() == 200)
{
resultString= readstream(httpResponse.getEntity().getContent());
Log.v(URL, resultString);
}else {
throw new Exception("can't connect the network");
}
return resultString;
}catch (Exception e) {
throw e;
}
}每次都是登陆失败 帮忙看看有什么问题
params.add(new BasicNameValuePair("username",UserName));
params.add(new BasicNameValuePair("password", Password));
String sourceString = Net.getInstance().post("http://zhixing.bjtu.edu.cn/member.php?mod=logging&action=login", params); Net.getInstance().post函数是这样的 public String post(String URL,List <NameValuePair> params) throws Exception
{
String resultString;
try {
HttpPost httpRequest = new HttpPost(URL);
// httpRequest.setEntity(new UrlEncodedFormEntity(params, "GB2312"));
httpRequest.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));
HttpResponse httpResponse = client.execute(httpRequest);
if(httpResponse.getStatusLine().getStatusCode() == 200)
{
resultString= readstream(httpResponse.getEntity().getContent());
Log.v(URL, resultString);
}else {
throw new Exception("can't connect the network");
}
return resultString;
}catch (Exception e) {
throw e;
}
}每次都是登陆失败 帮忙看看有什么问题
解决方案 »
- 将修改过的Android 4.0 源码如何正确合理的拷贝到 4.1上
- 关于imageView.setImageResource导致图像失真的问题
- eidttext如果有个标题在左边
- ndk编译x86可执行文件在linux中无法运行
- android opencv 下导入#include<opencv2/opencv.hpp>Unresolved inclusion
- android 音频接口通信
- 如何打造一个远端存储的记事本应用
- 新建安卓工程SRC下没有mainactivity
- 如图所示,希望能够从图库调用图片,选择后显示在imageview1里面,现在代码只能够调用图库,然后就没有反应了
- 环信sdk问题
- widget 如何控制在手机上重复添加同一个widget 小组件
- Android制作生日提醒备忘录
android 登录Javaeye(使用HttpURLConnection和HttpClient)
http://blog.csdn.net/dellheng/article/details/7063373