I have this:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/* Create a new TextView to display the parsing result later.
*/
TextView tv = new TextView(this);
try
{
/* Create a URL we want to load some xml-data from. */
String queryString = "http://weather.yahooapis.com/
forecastrss?p=36832";
/* Replace blanks with HTML-Equivalent. */
URL url = new URL(queryString.replace(" ", "%20"));
/* Get a SAXParser from the SAXPArserFactory. */
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
/* Get the XMLReader of the SAXParser we created. */
XMLReader xr = sp.getXMLReader();
/* Create a new ContentHandler and apply it to the XML-
Reader */
WeatherHandler myWeatherHandler = new WeatherHandler();
xr.setContentHandler(myWeatherHandler);
/* Parse the xml-data from our URL. */
xr.parse(new InputSource(url.openStream()));
/* Parsing has finished. */
tv.setText(myWeatherHandler.getInfo());
} catch (Exception e)
{
tv.setText("Error: " + e.getMessage());
Log.e(MY_DEBUG_TAG, "WeatherQueryError", e);
}
/* Display the TextView. */
setContentView(tv);
}
For some reason I get a bunch network errors:
10-07 14:22:21.702: ERROR/NetworkStateTracker(52): Can't set tcp
buffer sizes:java.io.FileNotFoundException: /sys/kernel/ipv4/
tcp_rmem_min
10-07 14:22:22.462: ERROR/AUWeather(156): WeatherQueryError
10-07 14:22:22.462: ERROR/AUWeather(156):
java.net.UnknownHostException: Host is unresolved:
weather.yahooapis.com:80
10-07 14:22:22.462: ERROR/AUWeather(156): at
java.net.Socket.connect(Socket.java:928)
I have added the internet permission and this code is almost line by
line just like the example. I am not behind a proxy either. Any ideas?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---