January 2014
Intermediate to advanced
736 pages
70h 43m
English
Recall that class ListFragment already contains a ListView, so we don’t need to inflate the GUI as in previous app’s Fragments. However, class ContactListFragment has tasks that should be performed after its default layout is inflated. For this reason, ContactListFragment overrides Fragment lifecycle method onViewCreated (Fig. 8.27), which is called after onCreateView.
53 // called after View is created54 @Override55 public void onViewCreated(View view, Bundle savedInstanceState)56 {57 super.onViewCreated(view, savedInstanceState);58 setRetainInstance(true ); // save fragment across config changes 59 setHasOptionsMenu( ...
Read now
Unlock full access