While most web services used with Android format their data feeds as JSON, there are still many services that only offer XML. You can easily parse an XML feed with a the XmlPullParser class that’s included in the Android SDK. There are other approaches available that require adding external libraries, such as my old favorite JDOM, but they won’t be any faster than what’s already available.
- [Instructor] While most web services used…with Android format their data feeds as JSON,…there are still many services that only offer XML.…I've provided an XML-based feed in the same location…on YouCanLearnIt.net,…and a switch from JSON to XML just changed…the sub-directory.…So, now I'm going to show you one way of downloading…and parsing XML and essentially doing the same thing…I already did with JSON.…Transforming an XML feed into a set of…strongly typed Java objects.…There are a few different ways to do this,…because there are many different XML parses for Java.…
But the easiest way is to use what's built into…the Android SDK.…A class named XML pull parser.…It's a streaming parser, that is,…it reads through the XML content,…and notifies the use of call back methods of certain events,…including when its read the start and end tags of an element…and when its read some useful text.…It's up to you to create the code that looks for…particular tags and extracts the data.…When I was working with the JSON feed,…I used the GSON library.…
IInstructor David Gassner starts with an overview discussion about available networking strategies, and then dives into how to declare networking permissions, make network requests, handle responses, parse data returned from a web service, and pass user credentials to services that support HTTP basic authentication. He also provides an overview of popular higher-level networking libraries, including OkHttp and Picasso, and offers recommendations for improving performance in network-connected apps. David also covers using static feeds, using dynamic PHP pages hosted on a public server web service, and integrating apps with network data storage.
- Integrating mobile apps
- Communicating with Android
- Preventing app freezes with background threads
- Preparing an app for network communication
- Declaring permissions
- Checking network connectivity
- Retrieving data over the web
- Using traditional APIs
- Using third-party libraries