Sunday, December 30, 2012

Set map type of GoogleMap

To set the type of map tiles, call setMapType(int type) method of the GoogleMap acquired in last exercise "Get GoogleMap from MapFragment/SupportMapFragment".

Where type can be:
  • MAP_TYPE_NONE
    No base map tiles.
  • MAP_TYPE_NORMAL
    Basic maps.
  • MAP_TYPE_SATELLITE
    Satellite maps with no labels.
  • MAP_TYPE_HYBRID
    Satellite maps with a transparent layer of major streets.
  • MAP_TYPE_TERRAIN
    Terrain maps.

Example:
   FragmentManager myFragmentManager = getSupportFragmentManager();
   SupportMapFragment mySupportMapFragment 
    = (SupportMapFragment)myFragmentManager.findFragmentById(R.id.map);
   myMap = mySupportMapFragment.getMap();
   
   myMap.setMyLocationEnabled(true);

   //myMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
   //myMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
   //myMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
   myMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);

MAP_TYPE_NORMAL
MAP_TYPE_NORMAL
MAP_TYPE_SATELLITE
MAP_TYPE_SATELLITE
MAP_TYPE_HYBRID
MAP_TYPE_HYBRID
MAP_TYPE_TERRAIN
MAP_TYPE_TERRAIN


The series:
A simple example using Google Maps Android API v2, step by step.


2 comments:

  1. how to animate to current location and what is alternative to itemizedoverlay and overlay classes?

    i mean how can i draw a path on map now?

    ReplyDelete
  2. Hi, first of all,good examples of the use of GoogleMaps API v2 and my question is how can i use the transport layer of google maps in my app?

    ReplyDelete