Android Programming Tutorials

(Romina) #1
Here a Post, There a Post

}

}

All we do here is create a map and set the initial zoom level.


Then, we need to make two changes to our AndroidManifest.xml file: we


need to add the StatusMap activity, and we need to indicate that we are


using the mapping services library. Alter Patchy/AndroidManifest.xml to look


like the following:


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="apt.tutorial.two"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application android:label="@string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".Patchy"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".EditPreferences">
</activity>
<activity android:name=".StatusMap">
</activity>
<service android:name=".PostMonitor" />
</application>
</manifest>

Step #3: Launch the Map on Location-Bearing Status


Click


Now, we need to tie Patchy and StatusMap together, such that a click on a


status that has an embedded location triggers the display of the map.


To do this, first we need to get control when a status is clicked. Right now,


the onCreate() in Patchy has a line that looks like:


((ListView)findViewById(R.id.timeline)).setAdapter(adapter);

237
Free download pdf