解析变量(android)

时间:2012-02-01 20:57:11

标签: java android eclipse variables scope

帮助!我目前正在关注如何在Android设备上通过httppost检索登录信息的教程,并且在使用标有星号的代码行时遇到问题。 eclipse声称无法将变量'is'解析为类型。这是范围问题吗?谢谢!

HttpClient httpclient=null;
HttpPost httppost=null;
HttpResponse response=null;
HttpEntity entity=null;
InputStream is=null;
try{
    httpclient=new DefaultHttpClient();
    httppost=new HttpPost("http://example.com");
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    response=httpclient.execute(httppost);
    entity=response.getEntity();
    is=entity.getContent();
}catch(Exception e){
    Log.e("log_tag", "Error in http connection "+e.toString());
}

BufferedReader reader=null;
try{
    reader=new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); //****************
}catch(Exception e){
    Log.e("log_tag", "Error converting result "+e.toString());
}

0 个答案:

没有答案