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.


thumbnail
Title: Set map type of GoogleMap
Rating: 100% based on 99998 ratings. 10 user reviews.
Post by

Related articles :

0 comments:

Post a Comment

My Blog List

 
Copyright © 2015. About - Web Version - Mobile Version Sitemap - Contact - Privacy