Mark,

Thanks for the help here.  Total noob.

So I tried some of the code in the tutorial out but I'm not receiving
anything - that I'm seeing.  Right now I'm just trying to pull a line
of text (baby steps).  Here's what I've got.

   String myOutput = "nothing was pulled";

    try {
        // Create a URL for the desired page
        URL url = new URL("http://breezylabs.com:80/quotes.txt";);

        // Read all the text returned by the server
        BufferedReader in = new BufferedReader(new InputStreamReader
(url.openStream()));
        String str;
        while ((str = in.readLine()) != null) {
            myOutput = str;
        }
        in.close();
    } catch (MalformedURLException e) {
    } catch (IOException e) {
    }

//put string myOutput into a TextView



Notice I initialized the string myOutput with data already.  This
tells me if I pulled anything from the server because if I did it
would change.

Can you see something I cant?


On Feb 24, 7:55 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> Breezy wrote:
> > Is there any good pre-defined classes that make downloading an XML
> > file off the internet a snap?  What about txt files, anything pretty
> > easy and "light"?
>
> URLConnection and the Apache HttpClient classes are both in Android.
> Both are used extensively in regular Java, outside of Android, as well.
>
> You will find URLConnection tutorials here:
>
> http://www.exampledepot.com/egs/java.net/pkg.html
>
> And HttpClient examples here:
>
> http://hc.apache.org/httpcomponents-client/examples.html
>
> > On top of that, how would I go about parsing an XML file?  Pulling
> > line by line off of a txt file isn't hard, but I think an XML file
> > would be more organized.  Any good tutorials on parsing an XML?
>
> Android has DOM, SAX, and XmlPullParser. The first two are (API-wise)
> straight out of standard Java, so there are many books and tutorials
> available, such as those at:
>
> http://www.exampledepot.com/egs/javax.xml.parsers/pkg.html
>
> XmlPullParser is described at:
>
> http://xmlpull.org/
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
> _The Busy Coder's Guide to Android Development_ Version 2.0 Published!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to