I created a kml using the kmllayer. When I set the map with a basemap and use the addLayer() method the kml is not shown. I can see the kml layer without a basemap. Can someone post sample code on using basemap with kml? am using ArcGISTiledMapServiceLayer as basemap


I added a KMLLayer to the HelloWorld sample that comes with the ArcGIS Android SDK.

public class HelloWorld extends Activity {
private String url = "http://code.google.com/apis/kml/documentation/us_states.kml";

MapView mMapView = null;
ArcGISTiledMapServiceLayer tileLayer;

/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {

    // Retrieve the map and initial extent from XML layout
    mMapView = (MapView)findViewById(R.id.map);
    /* create a @ArcGISTiledMapServiceLayer */
    tileLayer = new ArcGISTiledMapServiceLayer(

    // Create a new KML Layer
    SpatialReference sr = SpatialReference.create(102100);
    KMLLayer kmlLayer = new KMLLayer(url, sr);

    // Add tiled layer to MapView

    // Add KML Layer to MapView;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.