Eb 137

CC:CA:35:7B:1F:93:A7:91:AD:45" ffl^ft^. MD5 iUHtfi&r iflffl 13-8 ^f^o

; keytool ( ££ Java 0 ), C:\Documents and SettingsV

^'MiiSi Admin istrator\Local SettingsVApplication DataVAndroid>

"C:\Program Files\Java\jdkl.6.0_10\bin\keytool.exe" list -alias androiddebugkey

- keystore debug.keystore -storepass android -keypass android

•1J )l iX'J 'ffi , tt A M ill: http://code.google.com/intl/zh-CN/android/maps-api-signup.html, /l: Google if) Android map API Key i|Uit ftlM hJfoA#?41 2 ^SflM MD5 ikutlfitX, ty .f. Generate API Key ««ft, 13-9 W/j^jftifi, API Key*

0:>ii>* V\»i» -irut Thank you for »tgning up for an Android Mapa API h»y'

•n»». >«JIC*C4HM 'U , 1.1 IMY alr'Vitt»Vi|«u:<«4 «

»•to. ••»:»,:«; :c :< uiMH«" r... «, ir-»f<«v) ;.rr,

«.u<e-.i;. V;.:. -it a II 13-8 MD5 ikiiFfiSt a m 13-9 API Key h -'h VW'ttttttiiKttlftiftJ UI Map View

7 tAi J"" MapActivity (ft Activity-ShowTrack, JfRff)—/RSgfr, fi'Jifi "tft % show track.xml y^K tfarsw ^w^M^M^ view «

<view android: id-=,,@+id/mvM class="com.google.android.maps.MapView" android:layout_width="fil1 parent" android:layout height="fill_parent" android : layout, weight "1"

android: api Key- "0 I Yu9W3X3 vbpYT'ix33chPct97U1Z6j ySWYZXNFA"

H iWWft:

iSWiJi". it class Ji com.google.android.maps. Map View, SWiGHU ffiffitir l-ft'l1

■MWiiJMAPIKeyMtett£ "android:apiKey" rcigMft^fWT^O Ks

<?xml version="].0" encoding="utf-8"?>

<FrameLayout xrnlns:android-

"http://schemas.android.com/apk/res/android" android:layout width="fill parent"

android:layout_height-"fill parent" >

cview android:id="@+id/mv"

class="com.google.android.maps.MapView" android:layout width-"£ill_parent" android:layout_height-"fi11 parent" android:layout weight-"!"

android :apiKey="01Yu9W3X3vbpYT3x3'5chPct97UlZ6jy8WYZXNFA" />

<LinearLayout xrnlns:android=

"http://schemas.android.com/apk/res/android" android:orientat ion-"horizontaI" android:layout width-"fill_parent" android:layout height="wrap content" android:background-"#550000ff"

android:padding "Ipx" >

<Button android: id="S+ id/sat"

android : layout width- "wrap_content." android:layout height="wrap content" android: layout _marginl.ef t -"4Gpx" android:text="$string/satellite" />

<Button android:id="0 +id/traffic"

android:layout width="wrap content" android: layout_heighl "wrap content" android:text-"©string/traffic" />

<Button android:id-"@» xd/streetview" android: layout_widt.h "wrap_content" android:layout height="wrap_content" android:text="@string/street" />

<Button android:id="@+id/gps"

andr oid : layout widtri-"wrap_content" android:layout_height "wrap content" android:text="GPS" />

</LinearLayout>

<LinearLayout xmlns : android=

"http://schemas.android.com/apk/res/android" android:orientation^"vertical " android:layout_width="wrap content" android:layout height^"fill_parent" android:background="#55OOOQf f"

android:padding="Ipx"

<Button android:id="@4id/zin"

android:layout width="wrap_content" android:layout height -"wrap content" and r o i d:1a yout_ ma rginTop-"3 Op x" android:text="+" />

android:layout width-~"wrap content" android:layout height "wrap content" android:text="-" />

<Button android: id="(<? + id/pann"

android:layout width="wrap content" android:layout height "wrap content" android:text -"N" />

android: layout width~"wrap content" android:layout height "wrap content" android: text.-"E" />

<Button android:id^"@+id/panw"

android:layout _width="wrap_content" android:layout_height="wrap content" android:text="W" />

<Button android:id-"@+id/pans"

android:layout width "wrap content" android:layout height "wrap content" android:text="S" />

</LinearLayout>

Lifiiwh. «fl&fi&ft FrameLayout fatitZft, Mj/A

Wft maptilM<MandroidSDK rtKW. ffWffi/flSWiisM ^»¿j. Jt-A'-it &M U IEft manifest ifl'I'W application )iU A<uses-library android.name

-"com.google.android.maps" />BP "]', fifflij. #j8JlJ ClassNotFound Rift.

teJsm h'ShowTrack.java iff-, »jfe*« WB3J<I<J$ tt. ^JHWiUI KW^s private static final String TAG = "ShowTrack"; private static MapView mMapView; private MapControlier mc;

protected MyLocationOverlay mOverlayControllei;

private Button mZin;

private Button mZout?

private Button mPanN;

private? Button mPanE;

private Button mPanW;

private Button mPanS;

private Button mGps;

private Button niSat;

private Button mTraffic;

private Button mStreetvlew;

private String mDefCaption = "";

private GeoPoint mDefPoint;

private LocationManager 1m;

private LocationListener locationListener;

TonCrcate SjafiBinTBf^:

/** Called when the activity is first created. */ public void onCreate(Bundle icicle) ( super.onCreate(icicle);

requestWindowFeature(Window.FEATURE NO TITLE); setContentView(R.layout.show track);

WftPJJttl f fiFf/j^s private void findViewsO 1 Log.d(TAG, "find Views");

// KJR«ffl4>tfl$Btt mMapView - (MapView) findViewByld(R.id.mv); mMapView.getController().setZoom(10);

mZin - (Button) findViewByld(R.id.zin);

mZi r.. setOnClickListener (new OnCl ickLis tener () I

// ^Override public void onClick(View argO) \ zoomIn(); )

mZout = (Button) findViewByld(R.id.zout); mZout.setOnClickListener(new OnClickListener() I // (¿Override public void onClick(View argO) I zoomOut(); )

// iftttArt&aMftfi mPanN = (Button) findViewByld(R.id.pann); mPariN . setOnClickListener (new OnCl ickLis tener () \ // (? Over ride public void onClick(View argO) ( panNorth(); 1

// iftsr&i mPanE = (Button) findViewByld(R.id.pane); mPanE.setOnClickListener(new OnClickListener() { // (¿Override public void or.C_ick(View argO) { panEast();

mPanW - (Button) findViewByld(R.id.panw); mPanW.setOnClickListener(new OnClickListener() { // (¿Override public void onClick(View argO) \ panWest(); !

m 13 M Android -ST Google Map ft&^A&ihi&m

// iftÄl^J^S^tfl mPanS (Button) findViewByld(R.id.pans); mPanS.setOnClickListener(new OnClickListener() { // 6Override public void onClick(View argO) { panSouth(); )

//lös GPS fÄffl&tfl mGps = (Button) findViewByld(R.id.gps);

mGps.setOnClickListener(new OnClickListener() {

// (¿Override public void onClick(View argC) ( centerOnGPSPosition(); )

mSat - (Button) findViewByld(R.id.sat);

mSat.setOnClickListener(new OnClickListener() (

// (¿Override public void onClick(View argO) I toggleSatelli te(); )

mTraffic (Button) findViewByld(R.id.traffic); mTraffic.setOnClickListener(new OnClickListener() < // (¿Override public: void onclick (View argO) {

toggleTraffic(); }

mStreetview (Button) findViewByld(R.id.streetview); mStreet.view. setOnClickL - stener (new OnClickLi stener () | // (¿Override public void onClick(View argO) { toggleStreetView();

0 0

Post a comment