Skip to content

Instantly share code, notes, and snippets.

@omayib
Created November 24, 2012 03:05
Show Gist options
  • Save omayib/4138207 to your computer and use it in GitHub Desktop.
Save omayib/4138207 to your computer and use it in GitHub Desktop.
menampilkan map
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<com.google.android.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:apiKey="your_api_key"
android:clickable="true"
android:enabled="true" />
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.map"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<application
android:icon="@drawable/icon"
android:label="@string/app_name" >
<uses-library android:name="com.google.android.maps" />
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
package com.map;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
public class MainActivity extends MapActivity {
MapView mp;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mp = (MapView) findViewById(R.id.mapView);
mp.setBuiltInZoomControls(true);
mp.getController().setZoom(9);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment