在intentservice中解析从SSM收到的json字符串
String result=null,re="";
JSONObject jsonObject = null;
try{
result = httpURLConnection.getResponseMessage();
bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
}catch(IOException h)
{
intent1.putExtra("registerstate","httpURLConnection.getResponseMessage();失败");
}
String line;
try{
while((line=bufferedReader.readLine())!=null)
{
re+=line;
}
}catch(IOException e){
intent1.putExtra("registerstate","bufferedReader.readLine()失败");
}
Log.i("mss",re);
如果在声明re时使用re =null;Log.i(“mss”,re);输出的是null{“status”:1},如果换成re=”“,就不会在解析的字符串中出现null