CHAPTER 2 ANSWERS

1. You can either use the <fragment> element in the XML file, or use the FragmentManager and FragmentTransaction classes to dynamically add/remove fragments from an activity.

2. One of the main differences between activities and fragments is that when an activity goes into the background, the activity is placed in the back stack. This allows an activity to be resumed when the user presses the Back button. Conversely, fragments are not automatically placed in the back stack when they go into the background.

3. Adding action items to an Action Bar is similar to creating menu items for an options menu — simply handle the onCreateOptionsMenu() and onOptionsItemSelected() events.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset