BackgroundTask返回null。为什么?它应该返回try块中指定的字符串。
@Override
protected String doInBackground(Void...Voids)
{
try {
URL url = new URL(json_url);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
InputStream ip = httpURLConnection.getInputStream();
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(ip));
StringBuilder sb = new StringBuilder();
while ((json_string = bufferedreader.readLine())!= null)
{
sb.append(json_string + "\n");
}
bufferedreader.close();
ip.close();
httpURLConnection.disconnect();
return sb.toString().trim();
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
return null;
}
答案 0 :(得分:0)
您的return
try
区域内的logcat
尚未到达,可能发生任何异常并且已被捕获。检查您的<ul class="mylist">
<li><a href="">link 1</a></li>
<li><a href="">link 2</a></li>
</ul>
并找到问题所在。