Overriding Fragment Method onCreateView
Method onCreateView
(Fig. 7.13) inflates the DoodleFragment
’s GUI and initializes the instance variables. Like an Activity
, a Fragment
can place items in the app’s action bar and options menu. To do so, the Fragment
must call its setHasOptionsMenu
method with the argument true
. If the parent Activity
also has options menu items, then both the Activity
’s and the Fragment
’s items will be placed on the action bar and in the options menu (based on their settings).
31 // called when Fragment's view needs to be created32 @Override33 public View onCreateView(LayoutInflater inflater, ViewGroup container,34 Bundle savedInstanceState)35 {36 super ...
Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.