Thursday 3 January 2013

Google Maps Demo


1.Acitvity:

public class GoogleMapsDemoActivity extends MapActivity {
     
      /** Called when the activity is first created. */

      @Override
      public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

            MapView mapview = (MapView) findViewById(R.id.mapview);
      }

      @Override
      protected boolean isRouteDisplayed() {
            // TODO Auto-generated method stub
            return false;
      }
}

2.main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <com.google.android.maps.MapView
        android:id="@+id/mapview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="0MkgSgP6wZ0gbYcWJlGoHlz65uRAzeu98yhoTYA" />

</LinearLayout>

3.mainifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.inventiveera.googlemaps"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="14" />

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <uses-library android:name="com.google.android.maps" >
        </uses-library>

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

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

No comments:

Post a Comment