Android Programming The Big Nerd Ranch Guide by Bill Phillips, Chris Stewart, Kristin Marsicano (z-lib.org)
Networking Basics Finally, create the PhotoGalleryFragment class. Retain the fragment, inflate the layout you just created, and ...
Chapter 25 HTTP and Background Tasks In FlickrFetchr.java, add implementations for getUrlBytes(String) and getUrlString(String) ...
Asking permission to network Asking permission to network One other thing is required to get networking up and running: You have ...
Chapter 25 HTTP and Background Tasks Listing 25.5 Writing an AsyncTask, part I (PhotoGalleryFragment.java) public class PhotoG ...
You and Your Main Thread Now that you have created a background thread and run some networking code on it, let’s take a closer l ...
Chapter 25 HTTP and Background Tasks The Flash is like the main thread in your application. It runs all the code that updates t ...
Fetching JSON from Flickr Fetching JSON from Flickr JSON stands for JavaScript Object Notation, a format that has become popular ...
Chapter 25 HTTP and Background Tasks Listing 25.7 Adding constants (FlickrFetchr.java) public class FlickrFetchr { private sta ...
Fetching JSON from Flickr Finally, modify the AsyncTask in PhotoGalleryFragment to call the new fetchItems() method. Listing 25. ...
Chapter 25 HTTP and Background Tasks Now that you have such fine JSON from Flickr, what should you do with it? You do what you ...
Parsing JSON text Parsing JSON text The JSON response displayed in your browser and Logcat window is hard to read. If you pretty ...
Chapter 25 HTTP and Background Tasks The org.json API provides Java objects corresponding to JSON text, such as JSONObject and ...
Parsing JSON text Write a method that pulls out information for each photo. Make a GalleryItem for each photo and add it to a Li ...
Chapter 25 HTTP and Background Tasks The parseItems(...) method needs a List and JSONObject. Update fetchItems() to call parseI ...
From AsyncTask Back to the Main Thread From AsyncTask Back to the Main Thread To finish off, let’s switch to the view layer and ...
Chapter 25 HTTP and Background Tasks Next, add a RecyclerView.Adapter to provide PhotoHolders as needed based on a list of Gall ...
From AsyncTask Back to the Main Thread Now that you have the appropriate nuts and bolts in place for RecyclerView, add code to s ...
Chapter 25 HTTP and Background Tasks Now you need to call setupAdapter() after data has been fetched from Flickr. Your first in ...
Cleaning Up AsyncTasks Cleaning Up AsyncTasks In this chapter, your AsyncTask and other code was carefully structured so that yo ...
Chapter 25 HTTP and Background Tasks For the More Curious: More on AsyncTask In this chapter you saw how to use the last type p ...
«
21
22
23
24
25
26
27
28
29
30
»
Free download pdf