Editing Android Manifestxml

Take a look at the following AndroidManifest.xml file for the FindAFriend project. You need to add several Intent Filters for new Activities, including ones to edit a friend's location, edit a friend's name, and launch your Google Map.

Also, pay close attention to the actions within each Intent Filter. These represent actions that will be passed to each Activity handling that Intent. Finally, do not forget to add Access_Location and Access_GPS permission so that you can add your current location to the map as well.

The full AndroidManifest.xml file should appear as follows:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android_programmers_guide.FindAFriend"> <application android:icon="@drawable/icon">

<provider android:name="FriendsProvider"

android:authorities="android_programmers_guide.FindAFriend.Friends" />

<activity android:name=".FindAFriend" android:label="@string/app_name"> <intent-filter>

<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter>

<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.EDIT" /> <action android:name="android.intent.action.PICK" /> <category android:name="android.intent.category.DEFAULT" /> <dataandroid:mimeType="vnd.android.cursor.dir/ vnd.android_programmers_guide.friend" /> </intent-filter> <intent-filter>

<action android:name="android. intent.action.GET_CONTENT" /> <category android:name="android.intent.category.DEFAULT" /> <dataandroid:mimeType="vnd.android.cursor.item/ vnd.android_programmers_guide.friend" /> </intent-filter> </activity>

<activity android:name=".FriendsMap" android:label="FriendsMap"> <intent-filter>

<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER"

</intent-filter> </activity>

<activity android:name="LocationEditor" android:label="@string/title_note">

<intent-filter android:label="@string/resolve_edit">

<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.EDIT" /> <action android:name="com.google.android.notepad.action.EDIT_LOCATION" />

<category android:name="android.intent.category.DEFAULT" /> <dataandroid:mimeType="vnd.android.cursor.item/ vnd.android_programmers_guide.friend" /> </intent-filter>

<intent-filter>

<action android:name="android.intent.action.INSERT" /> <category android:name="android.intent.category.DEFAULT" /> <dataandroid:mimeType="vnd.android.cursor.dir/ vnd.android_programmers_guide.friend" /> </intent-filter>

</activity>

<activity android:name="NameEditor" android:label="@string/title_edit_title"

android:theme="@android:style/Theme.Dialog"> <intent-filter android:label="@string/resolve_title">

<action android:name="com.google.android.notepad.action.EDIT_NAME"

<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.ALTERNATIVE" /> <category android:name="android.intent.category.SELECTED_ALTERNATIVE" />

<dataandroid:mimeType="vnd.android.cursor.item/ vnd.android_programmers_guide.friend" /> </intent-filter> </activity> </application>

<uses-permission android:name="android.permission.ACCESS_GPS"> </uses-permission><uses-permission android:name="android.permission.ACCESS_LOCATION"> </uses-permission></manifest>

In the next section, you will create the first Activity for this project—NameEditor. As the name implies, this Activity will be launched when the user wishes to edit the name of a friend.

0 0

Post a comment