我有一个带有此功能的 IOException:
protected Boolean doInBackground(Object... params)
{
boolean result = false;
String path = (String) params[0];
table = (TableLayout) params[1];
XmlPullParser topScores = null;
Log.i("topTen","Entro en doInBsck "+path);
try {
Vector<NameValuePair> vars = new Vector<NameValuePair>();
vars.add(new BasicNameValuePair("figurename", "completo"));
String ind=path+URLEncodedUtils.format(vars, null);
URL xmlUrl=new URL(ind);
topScores = XmlPullParserFactory.newInstance().newPullParser();
topScores.setInput(xmlUrl.openStream(),null);
} catch (XmlPullParserException e) {
Log.i("topTen","Excepcion XML" );
Log.i("topTen",e.getLocalizedMessage());
topScores = null;
} catch(MalformedURLException e) {
Log.i("topTen","Excepcion URL" );
Log.i("topTen",e.getMessage());
topScores = null;
}
catch (IOException e) {
Log.i("topTen","Excepcion IO");
Log.i("topTen",e.getMessage());
topScores = null;
}
if(topScores != null) {
try {
processScores(topScores);
} catch (XmlPullParserException e) {
Log.e("DEBUG_TAG", "doInBackground() inside TopScoresDownloader : Pull Parser failure", e);
} catch (IOException e) {
Log.e("DEBUG_TAG", "doInBackground() inside TopScoresDonwloader : IO Exception parsing XML",e);
}
}
return result;
}
我在清单中有这些权限:
<user-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_ STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
在日志中我读到了这条消息:
<Unable to resolve host "ptha.ii.uam.es": No address associated with hostname>
我尝试在手机的浏览器中查看 url 并与 hem 连接!
我不知道是什么问题!