5.6.3. Overridden Fragment Method onCreateView
QuizFragment
’s onCreateView
method (Fig. 5.27) inflates the GUI and initializes most of the QuizFragment
’s instance variables—guessRows
and regionsSet
are initialized when the MainActivity
calls QuizFragment
’s updateGuessRows
and updateRegions
methods. After calling the superclass’s onCreateView
method (line 63), we inflate the QuizFragment
’s GUI (line 64–65) using the LayoutInflater
that method onCreateView
receives as an argument. The LayoutInflater
’s inflate method receives three arguments:
• the layout resource ID indicating the layout to inflate
• the ViewGroup
(layout object) in which the Fragment
will be displayed, which is received as onCreateView
’s second argument
• a boolean
indicating ...
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.