MapAPI.getNumLayers

 

int getNumLayers()

This method returns the number of layers in the map. This includes permanent, transient and special layers (See Overview of Data Layering).