I am trying to create an application that allows user's store RSS feeds and
view articles. I allow the user to enter a URL, but I am having trouble
parsing the XML. When I try to parse the XML from the URL the user entered
I get an UnknownHostException: Host is unresolved: ...
I have added *<uses-permission android:name="android.permission.INTERNET"
/> *to the Android manifest. I have been Google searching for a while but
the only solution I found on StackOverflow was to recreate the AVD, which
didn't work for me.
Any help would be appreciated.
Thanks!
*Code:*
public void createFeed(Context ctx, URL url) {
String method = "createFeed";
try {
targetFlag = TARGET_FEED;
mDb = new RSSDatabaseAdapter(ctx);
currentFeed.url = url;
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
xr.setContentHandler(this);
* xr.parse(new InputSource(url.openStream()));*
} catch (IOException e) {
Log.e(LOG_TAG, e.toString());
e.printStackTrace();
} catch (SAXException e) {
Log.e(LOG_TAG, e.toString());
e.printStackTrace();
} catch (ParserConfigurationException e) {
Log.e(LOG_TAG, e.toString());
e.printStackTrace();
}
}
*Stack Trace:*
01-06 10:33:43.811: E/com.lowpulse.rss.services.RSSHandler(351):
java.net.UnknownHostException: Host is unresolved: groups.google.com:443
01-06 10:33:43.811: W/System.err(351): java.net.UnknownHostException: Host
is unresolved: groups.google.com:443
01-06 10:33:43.831: W/System.err(351): at
java.net.Socket.connect(Socket.java:1038)
01-06 10:33:43.831: W/System.err(351): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
01-06 10:33:43.831: W/System.err(351): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
01-06 10:33:43.831: W/System.err(351): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
01-06 10:33:43.831: W/System.err(351): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
01-06 10:33:43.831: W/System.err(351): at
org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:396)
01-06 10:33:43.831: W/System.err(351): at
org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:1152)
01-06 10:33:43.831: W/System.err(351): at
org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:253)
01-06 10:33:43.831: W/System.err(351): at
java.net.URL.openStream(URL.java:653)
01-06 10:33:43.841: W/System.err(351): at
com.lowpulse.rss.services.RSSHandler.createFeed(RSSHandler.java:155)
01-06 10:33:43.841: W/System.err(351): at
com.lowpulse.rss.activities.RSSAddFeed.okClicked(RSSAddFeed.java:44)
01-06 10:33:43.841: W/System.err(351): at
com.lowpulse.rss.activities.RSSAddFeed$1.onClick(RSSAddFeed.java:33)
01-06 10:33:43.841: W/System.err(351): at
android.view.View.performClick(View.java:2408)
01-06 10:33:43.841: W/System.err(351): at
android.view.View$PerformClick.run(View.java:8816)
01-06 10:33:43.841: W/System.err(351): at
android.os.Handler.handleCallback(Handler.java:587)
01-06 10:33:43.841: W/System.err(351): at
android.os.Handler.dispatchMessage(Handler.java:92)
01-06 10:33:43.841: W/System.err(351): at
android.os.Looper.loop(Looper.java:123)
01-06 10:33:43.841: W/System.err(351): at
android.app.ActivityThread.main(ActivityThread.java:4627)
01-06 10:33:43.841: W/System.err(351): at
java.lang.reflect.Method.invokeNative(Native Method)
01-06 10:33:43.841: W/System.err(351): at
java.lang.reflect.Method.invoke(Method.java:521)
01-06 10:33:43.841: W/System.err(351): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-06 10:33:43.841: W/System.err(351): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-06 10:33:43.841: W/System.err(351): at
dalvik.system.NativeStart.main(Native Method)
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en