为什么第二个try的BufferedReader reader=new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
这句和is.close();这句话会出错呢
try{
HttpClient httpclient=new DefaultHttpClient();
HttpPost httppost=new HttpPost("http://110.86.69.250/getAllPeopleBornAfter.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response =httpclient.execute(httppost);
HttpEntity entity=response.getEntity();
InputStream is=entity.getContent();
}catch(Exception e){
Log.e("log_tag", "Error in http connection" + e.toString());
}
try{
BufferedReader reader=new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
StringBuilder sb=new StringBuilder();
String line =null;
while((line=reader.readLine())!=null){
sb.append(line+"\n");
}
is.close();
result=sb.toString();
}catch(Exception e){
Log.e("log_tag","Error converting result" + e.toString());
}
这句和is.close();这句话会出错呢
try{
HttpClient httpclient=new DefaultHttpClient();
HttpPost httppost=new HttpPost("http://110.86.69.250/getAllPeopleBornAfter.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response =httpclient.execute(httppost);
HttpEntity entity=response.getEntity();
InputStream is=entity.getContent();
}catch(Exception e){
Log.e("log_tag", "Error in http connection" + e.toString());
}
try{
BufferedReader reader=new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
StringBuilder sb=new StringBuilder();
String line =null;
while((line=reader.readLine())!=null){
sb.append(line+"\n");
}
is.close();
result=sb.toString();
}catch(Exception e){
Log.e("log_tag","Error converting result" + e.toString());
}
解决方案 »
- 求高手解答android 图片下载问题
- android engine
- 在一個project中創建contentprovider后,如何在另一個新的android project的code中access
- sim卡存储问题
- Activity设置成SingleInstance模式切换的时候为什么会闪一下标题(显示一下标题+黑屏)?不设置几个Activity间切换就不会
- intent打开“geo”格式的东西出错
- service主线程是否可以做访问网络操作
- phonegap链接下载的问题
- REST服务,webService服务的区别,哪位大神给简单指点一下!谢过了
- 求助!这个空指针的bug'boolean android.graphics.Bitmap.compress‘该怎么改?
- android httpclient请求数据关闭问题
- android httpclient请求数据关闭问题
HttpClient httpclient=new DefaultHttpClient();
HttpPost httppost=new HttpPost("http://110.86.69.250/getAllPeopleBornAfter.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response =httpclient.execute(httppost);
HttpEntity entity=response.getEntity();
InputStream is=entity.getContent();
BufferedReader reader=new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
StringBuilder sb=new StringBuilder();
String line =null;
while((line=reader.readLine())!=null){
sb.append(line+"\n");
}
is.close();
result=sb.toString();
}catch(Exception e){
Log.e("log_tag", "Error in http connection" + e.toString());
}
try{
HttpClient httpclient=new DefaultHttpClient();
HttpPost httppost=new HttpPost("http://110.86.69.250/getAllPeopleBornAfter.php");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response =httpclient.execute(httppost);
HttpEntity entity=response.getEntity();
is=entity.getContent();
}catch(Exception e){
Log.e("log_tag", "Error in http connection" + e.toString());
}
try{
BufferedReader reader=new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);
StringBuilder sb=new StringBuilder();
String line =null;
while((line=reader.readLine())!=null){
sb.append(line+"\n");
}
is.close();
result=sb.toString();
}catch(Exception e){
Log.e("log_tag","Error converting result" + e.toString());
}