January 2014
Intermediate to advanced
736 pages
70h 43m
English
Fragment lifecycle method onResume (Fig. 8.29) creates and executes an AsyncTask (line 93) of type GetContactsTask (defined in Fig. 8.30) that gets the complete list of contacts from the database and sets the contactAdapter’s Cursor for populating the ContactListFragment’s ListView. AsyncTask method execute performs the task in a separate thread. Method execute’s argument in this case indicates that the task does not receive any arguments—this method can receive a variable number of arguments that are, in turn, passed as arguments to the task’s doInBackground method. Every time line 93 executes, it creates a new GetContactsTask object—this is required because each AsyncTask can be executed only once ...
Read now
Unlock full access