Android Programming Tutorials

(Romina) #1
Posts On Location

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/prefs"
android:title="Settings"
android:icon="@drawable/ic_menu_preferences"
/>
<item android:id="@+id/location"
android:title="Insert Location"
android:icon="@drawable/ic_menu_compass"
/>
</menu>

You will also need a suitable icon, such as ic_menu_compass.png from the


Android SDK.


If you recompile and reinstall the application, you will see the new menu


option, even though it does not do anything just yet:


Figure 37. The Insert Location menu item in Patchy

Step #4: Insert the Last Known Location


Finally, we need to do something to add the location to our status message.


230
Free download pdf