I want to add a CloudMade map to Esri's Android HelloWorld application. I'm following the documentation, but when I run the app, LogCat throws an EsriService Exception and the app closes. Below is the relevant code. Does anyone have an idea on what I need to change to display a CloudMade basemap? I posted this question on ArcGIS Forum a few days ago, but no response there yet. I'm working with ArcGIS Runtime SDK for Android 10.2.2. Thanks, Patty

public class HelloWorld extends Activity {
MapView mMapView;

 // Called when the activity is first created.
 public void onCreate(Bundle savedInstanceState) {
 mMapView = (MapView)findViewById(R.id.map);
 String[] tileServerURL = {"http://b.tile.cloudmade.com/{KEY}/1/256"};
 OpenStreetMapLayer tileLayer = new OpenStreetMapLayer(tileServerURL, 1, 16, "CloudMade", true);

 mMapView.addLayer(tileLayer); //when this line is commented out the app runs, but only with an Esri base map

The reason why the app runs when you comment out the mMapView.addLayer(tileLayer) is that the MapView's basemap is set in XML. Open up the /res/layout/main.xml file and comment out all the mapoptions parameters. Your XML should look like this:

<!-- MapView layout, including basemap layer, initial center point, and zoom level --> <com.esri.android.map.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent" />

I can confirm that the url you provide resolves to http://b.tile.cloudmade.com/myKey/1/256 at runtime.

  • Hi, thanks for the response. I added the code you gave to my XML. The app remain opens now when I run it, but I see the Open Street Map, not the map I am specifying via CloudMade. I tried other URLs from this link too. If you have other suggestions, please let me know. Thanks, patty
    – Patty Jula
    Apr 10 '14 at 14:26
  • I am confused when you put in your CloudMade URL setting the key in the API you get the Open Street Map and not your map?
    – jdONeill
    Apr 11 '14 at 1:46
  • Yeah, I think what's happening is that the OSM I set as the base layer in the arcgis.com map called in this Android app is displaying. This would indicate I'm still a little stuck on how to call a cloudmade map in this application. Tomorrow I'm going to create a map service containing my vector data. That should at least put me in better shape for testing a new base map. Thanks,
    – Patty Jula
    Apr 14 '14 at 4:11

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.