skill paper

  • paper

Saturday, August 27, 2011

Map for Beginners

Sample map:
       Create new project,(file->new->androis project).
     Add permission to access internet in manifestXml.
    
    
    

   Next edit main.xml:
             
  ?xml version="1.0" encoding="utf-8"?>  
RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"> 
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
com.google.android.maps.MapView>

      android:id="@+id/mapview"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:clickable="true"
    android:apiKey="Your Maps API Key" />


Iam Sure your u have Api key...

    1. public class HelloMapView extends MapActivity {}
                                           - extend mapActivity instead od Activity .
     2. protected boolean isRouteDisplayed()
{
   
return false;//override this into false
}


      3.initialize below in oncreate()
     mapView = (MapView) findViewById(R.id.mapview);
     mapView
.setBuiltInZoomControls(true);


NOW RUN IT....
you seem to get like this

Generally Map Load from USA and BRASIL.you can change the to your location....
for your query post me here,

No comments:

Post a Comment