January 2014
Intermediate to advanced
736 pages
70h 43m
English
Method onCreate (Fig. 8.15) inflates MainActivity’s GUI and, if the app is running on a phone-sized device, displays a ContactListFragment. As you’ll see in Section 8.6, you can configure a Fragment to be retained across configuration changes, such as when the user rotates the device. If the Activity is being restored after being shut down or recreated from a configuration change, savedInstanceState will not be null. In this case, we simply return (line 28) because the ContactListFragment already exists—on a phone, it would have been retained and on a tablet, it’s part of the MainActivity’s layout that was inflated in line 24.
19 // display ContactListFragment when MainActivity ...
Read now
Unlock full access