package com.esri.arcgis.android.samples.webmap; import android.app.Activity; import android.os.Bundle; import com.esri.android.map.MapView; public class WebMap extends Activity { MapView mMapView = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mMapView = new MapView( getApplicationContext(), "http://www.arcgis.com/home/item.html?id=f8ab9f0b818b4ece966c4b2cf91fa0c1", null, null); setContentView(mMapView); } @Override protected void onPause() { super.onPause(); mMapView.pause(); } @Override protected void onResume() { super.onResume(); mMapView.unpause(); } }
I happen to have the same problem as Esther, but when I attempted to use this code, AndroidStudio wouldn't let me import the MapView class like you did at the top. How do I fix this?
Reena, can you confirm that you've followed the steps in this tutorial? Develop your first map app with Java—ArcGIS Runtime SDK for Android | ArcGIS for Developers
Hi Esther - you might find some of the Dev Labs useful - we have a Dev Lab which covers displaying a web map in a simple Android app - Display a web map | ArcGIS for Developers (this builds on a basic app where you create a map directly in code - just like the initial tutorial you followed). You can find all of the Android-specific Dev Labs here - Browse ArcGIS DevLabs | ArcGIS for Developers - there's also Dev Labs for users new to ArcGIS, covering importing and preparing data, and designing and configuring maps, so possibly you'll find these useful as well? (Not sure if you're also new to ArcGIS generally, or just the ArcGIS Runtime SDK for Android) - Get Started with ArcGIS DevLabs | ArcGIS for Developers .
Cheers,
Shelly