Android Programming The Big Nerd Ranch Guide by Bill Phillips, Chris Stewart, Kristin Marsicano (z-lib.org)
11. Using ViewPager In this chapter, you will create a new activity to host CrimeFragment. This activity’s layout will consist o ...
Chapter 11 Using ViewPager Figure 11.2 shows an updated diagram for CriminalIntent. The new activity will be named CrimePagerAc ...
Creating CrimePagerActivity Creating CrimePagerActivity CrimePagerActivity will be a subclass of AppCompatActivity. It will crea ...
Chapter 11 Using ViewPager In CrimePagerActivity, set the ViewPager’s pager adapter and implement its getCount() and getItem(in ...
Integrating CrimePagerActivity Integrating CrimePagerActivity Now you can begin the process of decommissioning CrimeActivity and ...
Chapter 11 Using ViewPager You also need to add CrimePagerActivity to the manifest so that the OS can start it. While you are i ...
FragmentStatePagerAdapter vs FragmentPagerAdapter FragmentStatePagerAdapter vs FragmentPagerAdapter There is another PagerAdapte ...
Chapter 11 Using ViewPager Figure 11.5 FragmentPagerAdapter’s fragment management Which kind of adapter you should use depends ...
For the More Curious: Laying Out Views in Code When would you need to implement the PagerAdapter interface yourself? When you wa ...
Chapter 11 Using ViewPager In fact, you could have defined your ViewPager in code without a layout file at all: @Override prote ...
12. Dialogs Dialogs demand attention and input from the user. They are useful for presenting a choice or important information. ...
Chapter 12 Dialogs When Lollipop was released, dialogs were given a visual makeover. AlertDialogs on Lollipop automatically use ...
Creating a DialogFragment For CriminalIntent, you are going to create a DialogFragment subclass named DatePickerFragment. Within ...
Chapter 12 Dialogs Create a new class named DatePickerFragment and make its superclass DialogFragment. Be sure to choose the su ...
Showing a DialogFragment Showing a DialogFragment Like all fragments, instances of DialogFragment are managed by the FragmentMan ...
Chapter 12 Dialogs Run CriminalIntent and press the date button to see the dialog (Figure 12.4). Figure 12.4 An AlertDialog wi ...
Setting a dialog’s contents In DatePickerFragment.onCreateDialog(Bundle), inflate this view and then set it on the dialog. Listi ...
Chapter 12 Dialogs Figure 12.7 An AlertDialog with a DatePicker Either version works fine. The newer one sure is pretty, thoug ...
Passing Data Between Two Fragments Your dialog is onscreen and looks good. In the next section, you will wire it up to present t ...
Chapter 12 Dialogs Passing data to DatePickerFragment To get data into your DatePickerFragment, you are going to stash the date ...
«
8
9
10
11
12
13
14
15
16
17
»
Free download pdf