MapmyIndia offers a range of preset styles to rendering the map. The user has to retrieve a list of styles for a specific account. The listing api would help in rendering specific style as well as facilitate the switching of style themes.
From the below reference code it would become quite clear that user has to specify style names and not URLs to use them. A default style is set for all account users to start with. To know more about available styles, kindly contact apisupport@mapmyindia.com
This feature is available from version v6.8.14
To get the list of available styles:
List<MapmyIndiaStyle> styleList = mapmyIndiaMap.getMapmyIndiaAvailableStyles();
val styleList = mapmyIndiaMap.getMapmyIndiaAvailableStyles()
MapmyIndiaStyle
contains below parameters:
description(String)
: Description of the styledisplayName(string)
: Generic Name of style mostly used in MapmyIndia content.imageUrl(String)
: Preview Image of stylename(String)
: Name of style used to change the style.
To set MapmyIndiaMaps style reference code is below:
mapmyIndiaMap.setMapmyIndiaStyle(name, new OnStyleLoadListener() {
@Override
public void onError(String error) {
Toast.makeText(MapActivity.this, error, Toast.LENGTH_SHORT).show();
}
@Override
public void onStyleLoaded(Style styles) {
Toast.makeText(MapActivity.this, "onStyleLoaded", Toast.LENGTH_SHORT).show();
}
});
//OR
mapmyIndiaMap.setMapmyIndiaStyle(name);
mapmyIndiaMap.setMapmyIndiaStyle(style, object : OnStyleLoadListener {
override fun onError(p0: String?) {
Toast.makeText(this@MainActivity, p0, Toast.LENGTH_LONG).show()
}
override fun onStyleLoaded(style: Style) {
Toast.makeText(this@MainActivity, "Style loaded Successfully", Toast.LENGTH_LONG).show()
}
})
//OR
mapmyIndiaMap.setMapmyIndiaStyle(name)
To enable/disable loading of last selected style:
MapmyIndiaMapConfiguration.getInstance().setShowLastSelectedStyle(false); //true is enable & false is disable(default value is true)
MapmyIndiaMapConfiguration.getInstance().setShowLastSelectedStyle(false) //true is enable & false is disable(default value is true)
To get the currently selected style name:
mapmyIndiaMap.getMapmyIndiaStyle();
mapmyIndiaMap.getMapmyIndiaStyle()
For any queries and support, please contact: