January 2014
Intermediate to advanced
736 pages
70h 43m
English
Fragment lifecycle method onResume (Fig. 8.46) creates and executes an AsyncTask (line 102) of type LoadContactTask (defined in Fig. 8.49) that gets the specified contact from the database and displays its data. Method execute’s argument in this case is the rowID of the contact to load. Every time line 102 executes, it creates a new LoadContactTask object—again, this is required because each AsyncTask can be executed only once.
97 // called when the DetailsFragment resumes98 @Override99 public void onResume()100 {101 super.onResume();102 new LoadContactTask().execute(rowID); // load contact at rowID 103 }104
Fig. 8.46 | DetailsFragment ...
Read now
Unlock full access