Android Programming The Big Nerd Ranch Guide, 3rd Edition
Passing data to DatePickerFragment 237 DatePickerFragment needs to initialize the DatePicker using the information held in the D ...
Chapter 12 Dialogs 238 Returning data to CrimeFragment To have CrimeFragment receive the date back from DatePickerFragment, you ...
Returning data to CrimeFragment 239 Sending data to the target fragment Now that you have a connection between CrimeFragment and ...
Chapter 12 Dialogs 240 Now it is time to use this new sendResult(...) method. When the user presses the positive button in the ...
Returning data to CrimeFragment 241 The code that sets the button’s text is identical to code you call in onCreateView(...). To ...
Chapter 12 Dialogs 242 Make the method private and name it updateDate. Click OK and Android Studio will tell you that it has fo ...
Returning data to CrimeFragment 243 More flexibility in presenting a DialogFragment Using onActivityResult(...) to send data bac ...
Chapter 12 Dialogs 244 On a tablet, where you have plenty of room, it is often better to present a DialogFragment to the user t ...
Challenge: More Dialogs 245 Challenge: More Dialogs Write another dialog fragment named TimePickerFragment that allows the user ...
...
247 13. The Toolbar A key component of any well-designed Android app is the toolbar. The toolbar includes actions that the user ...
Chapter 13 The Toolbar 248 AppCompat The toolbar component was added to Android in Android 5.0 (Lollipop). Prior to Lollipop, t ...
Using the AppCompat library 249 Listing 13.2 Using an AppCompat theme (res/values/styles.xml) @color/colorPrimary @color/col ...
Chapter 13 The Toolbar 250 Menus The top-right area of the toolbar is reserved for the toolbar’s menu. The menu consists of act ...
Defining a menu in XML 251 Figure 13.3 Creating a menu file Here, you use the same naming convention for menu files as you do f ...
Chapter 13 The Toolbar 252 If you have items in the overflow menu, those items will be represented by the three dots on the far ...
Defining a menu in XML 253 Using Android Asset Studio In the android:icon attribute, the value @android:drawable/ic_menu_add ref ...
Chapter 13 The Toolbar 254 Figure 13.5 Asset Studio Select the Clip Art button to pick your clip art. In the clip art window, ...
Defining a menu in XML 255 Back on the main screen, click Next to move to the last step of the wizard. The Asset Studio will sho ...
Chapter 13 The Toolbar 256 Creating the menu In code, menus are managed by callbacks from the Activity class. When the menu is ...
«
9
10
11
12
13
14
15
16
17
18
»
Free download pdf