January 2014
Intermediate to advanced
736 pages
70h 43m
English
Nested class GetContactsTask (Fig. 8.30) extends class AsyncTask. The class defines how to interact with the DatabaseConnector (Section 8.9) to get the names of all the contacts and return the results to this Activity’s GUI thread for display in the ListView. AsyncTask is a generic type that requires three type parameters:
• The variable-length parameter-list type for AsyncTask’s doInBackground method (lines 103–108)—When you call the task’s execute method, doInBackground performs the task in a separate thread. We specify Object as the type parameter and pass null as the argument to the AsyncTask’s execute method, because GetContactsTask does not require additional data to perform its task.
• The variable-length ...
Read now
Unlock full access