Thursday 3 January 2013

Steps to Build Google Map Program - Android



Permissions:
To Run Google Maps we need take two permissions

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

2)LIBRARY
Ex:
After opne <application> tag we write this code.
<uses-library android:name="com.google.android.maps" >
        </uses-library>


For Create Program:

1)Create a New Project with Google Api.

2)Extend your class by MapActivity.
Ex:
GoogleMapDemo extends MapActivity{
}

3)Add UnImplemented methods.
Ex:


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



4)Go to your main.xml and Paste MapView Code
Ex:
    <com.google.android.maps.MapView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:apiKey="0MkgSgP6wZ0gbYcWJlGoHlz65uRAzeu98yhoTYA" />

5)set the id for MapView.
Ex:
       android:id="@+id/mapview"

6)Go to your Activity and take MapView reference.
Ex:

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



No comments:

Post a Comment