In the previous video, I described how to load images at the same time as you load data from a web service. But as you saw in the demonstration, when you code the app that way, it results in a long delay when you first load the data, because you're not just loading the JSON or XML, you're loading all the images at the same time. Once everything's loaded, everything scrolls smoothly, but you might want to speed up the initial loading and delay the loading of the images until they're needed.
- [Narrator] In the previous video,…I described how to load images…right after loading data from a web service.…But as you saw in the demonstration,…when you code the app that way,…it results in a delay between the time…you load the data and the time the images show up.…And that's because you're loading all of the images…at the same time.…Once everything's loaded, everything scrolls smoothly…but you might want to change this approach…so that you only load each image…the first time it's needed.…This is a process that's sometimes called Lazy Loading.…Essentially the strategy is to download…images from the web only when you need them.…
For this version of my application,…I've changed the structure of my Data Item Adapter class.…It now has a definition of AsyncTask.…I'm using AsyncTask instead of AsyncTaskLoader…because now each instance of this class…will only be responsible for a single image file.…And my image files are optimized,…they're very small.…So each time I need an image,…I'll create an instance of this AsyncTask…
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