My next step after retrieving data from a web service is to run it into something I can store and manipulate in memory. This usually means transforming a blob of text into a set of Java objects that contains the data you retrieved. So you should next create one or more Java classes that have a structure that matches the data.
- [David] I'm now successfully…retrieving data from a web service,…and I want to turn it into something I can store,…and manipulate in memory.…This usually means transforming a blob of text…into a set of Java objects that contain…the data you retrieved.…So, the next step is to create one or more Java classes…that have a structure that matches the data.…You could do this all manually.…These are going to be Plain Old Java Object classes,…or POJOs, that have fields and setter and getter methods.…But there are some really useful tools on the web…that can do some of the work for you.…
I'll show you one of these.…I can't guarantee that this particular tool…will be available by the time you use this course,…because it's just there…because of a really generous developer.…But if you can't find it,…you can Google around to find something similar.…This particular application is called jsonschema2pojo,…and it has a number of different ways…that it can use to convert JSON strings…into POJO class definitions.…The default has a package of com.example,…
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