Using the Google Maps library, you can create your own map-viewing Activity. In this tutorial,
you’ll create a simple map application in which u will be able to display a map in your activity
and then can place overlay items over it with a marker. The following steps are required to
integrate google maps library in your SDK and create a project to display a map view in your

STEP 1: 

The Maps library is included with the Google APIs add-on, which you can install using the
Android SDK and AVD Manager. To learn how, see Installing the Google APIs Add-On.

STEP 2: Creating a basic map application
• Start a new project named AndroidGoogleMapsActivity.
• Because the Maps library is not a part of the standard Android library, you must declare
it in the Android Manifest. Open the AndroidManifest.xml file and add the following  as a child of the <application> element:

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

• Now sign your application with a debug key store. You can find the location of debug key 

store under Windows -> Preferences -> Android -> Build. I will suggest you to copy
the debug key store somewhere else into your drive and then sign the application.
• Open your command prompt and give the following command:
keytool.exe –list -v -alias “alies name ” -keystore “PATH OF THE KEYSTORE” –
storepass “ALIAS PASSWD” -keypass “KEYSTORE PASSWD”
As you will press the Enter command an MD5 key will be generated which will be used to
register your app onto the google API access.
• Go do the directed link: Google Maps Android API v1 Key Signup  and enter your MD5 key and it will generate the required API Key and that means your application now signed with Google API certificate.
• Now enter this API key in your xml where you are using a mapView.

<?xml version="1.0" encoding="utf-8"?>

• Now go to the and add the following code in the onCreate Method:


MapView mapView = (MapView) findViewById(;
        /** To set the street view of the map */
        /** To set the satellite view of the map */

         * To set the Google Maps to display a particular location we can use
         * the animateTo() method of the MapController class.
        mc = mapView.getController();

        String coordinates[] = { "28.666", "77.2167" };
        double lat = Double.parseDouble(coordinates[0]);
        double lng = Double.parseDouble(coordinates[1]);

        p = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));


        // ---Add a location marker using a MapOverlay class ---
        MapOverlay mapOverlay = new MapOverlay();
        List<Overlay> listOfOverlays = mapView.getOverlays();


Copy the MapOverlay Class from the below code :

class MapOverlay extends {

/* In the MapOverlay class that we have overrided the draw() method so  that we can draw the push pin image on the map. */

public boolean draw(Canvas canvas, MapView mapView, boolean shadow,long when) {
    super.draw(canvas, mapView, shadow);

    // ---translate the GeoPoint to screen pixels---
    Point screenPts = new Point();
    mapView.getProjection().toPixels(p, screenPts);

    // ---add the marker---
    Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.mark_red);
    canvas.drawBitmap(bmp, screenPts.x, screenPts.y - 50, null);
    return true;


Now you will be able to see a MAPVIEW of the location i have used .So now u can customize this code as per your requirement .Enjoy with the vairous GOOGLE  MAPS applications.

Hope you enjoy reading this post as I did in writing… Will love to have your comments and feedback if any to make this post more interesting and useful.

Post By: Nishank Agarwal