July 2015
Beginner to intermediate
600 pages
18h 59m
English
Now that you can turn your alarm on and off (as well as tell whether it is on or off), let’s add an interface to turn this thing on and off. Add another menu item to menu/fragment_photo_gallery.xml.
Listing 26.11 Adding service toggle (menu/fragment_photo_gallery.xml)
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/menu_item_search"
... />
<item android:id="@+id/menu_item_clear"
... />
<item android:id="@+id/menu_item_toggle_polling"
android:title="@string/start_polling"
app:showAsAction="ifRoom" />
</menu>
Then you need to add a few new strings – one to start polling and one to stop polling. (You will need a ...
Read now
Unlock full access