1

I have the following activity called activity_esri_map:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.stevecortis.wmsdemo.MainActivity">

<com.esri.android.map.MapView
    android:id="@+id/arcMap"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    mapoptions.MapType="Topo"
    mapoptions.ZoomLevel="13"
    mapoptions.center="33.666354, -117.903557" />

This is called from the MainActivity:

final MapOptions mStreetsBasemap = new MapOptions(MapOptions.MapType.STREETS);

private MapView arcMapView;


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_esri_map);
    arcMapView = (MapView) findViewById(R.id.arcMap);
    arcMapView.setMapOptions(mStreetsBasemap);
}

From the MainActivity I haven't been able to change anything from tha map. It seems like the findViewById(R.id.arcMap) It is not being assigned to the arcMapView.

I have tried to change other things such as Scale, and nothing seems to affect the actual MapView.

1

You are setting the MapView's MapOptions twice, first in the layout through the mapoptions. parameter settings then in code with arcMapView.setMapOptions(mStreetsBasemap);. With both of these set you should see the Topo Basemap which is coming from your layout View. You should remove arcMapView.setMapOptions(mStreetsBasemap); from your source. If you want the Streets basemap set it in you layout view, e.g. mapoptions.MapType="STREETS".

  • But I need to be able to change it programmatically, and I thought that with arcMapView.setMapOptions(mStreetsBasemap); I was doing it correctly. – SitRock Apr 21 '15 at 16:29
  • Take a look at the Basemaps (github.com/Esri/arcgis-runtime-samples-android/tree/master/…) sample to see how to work with MapOptions in your layout view and programmatically. – jdONeill Apr 21 '15 at 17:33

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.