January 2014
Intermediate to advanced
736 pages
70h 43m
English
Fragment lifecycle method onStop (Fig. 8.31) is called after onPause when the Fragment is no longer visible to the user. In this case, the Cursor that allows us to populate the ListView is not needed, so line 123 calls CursorAdapter method getCursor to get the current Cursor from the contactAdapter. Line 124 calls CursorAdapter method changeCursor with the argument null to remove the Cursor from the CursorAdapter. Then line 127 calls Cursor method close to release resources used by the Cursor.
119 // when fragment stops, close Cursor and remove from contactAdapter120 @Override121 public void onStop()122 {123 Cursor cursor = contactAdapter.getCursor(); ...
Read now
Unlock full access