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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.