AnsweredAssumed Answered

Cannot make GraphicsLayer the first layer in MapView

Question asked by stephen_quan on Feb 20, 2012
Latest reply on Feb 20, 2012 by stephen_quan
I got the Hello World Map sample working with a GraphicsLayer containing two points (two points on the ESRI Redlands campus). When I run the sample with the World_Street_Map ArcGIS Online layer as the first layer in my MapView it all works fine. However, when I remove the ArcGIS Online layer the GraphicsLayer and its points are no longer shown. Instead, I get a blank empty white screen. I just simply want a map that has the GraphicsLayer, any advice on how to do that?

package; import; import; import android.os.Bundle; import; import; import; import com.esri.core.geometry.GeometryEngine; import com.esri.core.geometry.Point; import com.esri.core.geometry.SpatialReference; import; import com.esri.core.symbol.SimpleMarkerSymbol; import com.esri.core.symbol.SimpleMarkerSymbol.STYLE;  public class HelloWorldMapActivity extends Activity {  MapView map = null;  SpatialReference webMercator = SpatialReference.create(102100);  SpatialReference wgs84 = SpatialReference.create(4326);   public void onCreate(Bundle savedInstanceState) {   super.onCreate(savedInstanceState);   setContentView(R.layout.main);    // Retrieve the map and initial extent from XML layout   map = (MapView)findViewById(;   /*   map.addLayer(new ArcGISDynamicMapServiceLayer("" +     ""));   */        GraphicsLayer graphicsLayer = new GraphicsLayer();   Point redlands1 = (Point) GeometryEngine.project(new Point(-117.1990, 34.05564), wgs84, webMercator);   Point redlands2 = (Point) GeometryEngine.project(new Point(-117.1922, 34.05797), wgs84, webMercator);   graphicsLayer.addGraphic(new Graphic(redlands1, new SimpleMarkerSymbol(Color.GREEN, 15, STYLE.CIRCLE)));   graphicsLayer.addGraphic(new Graphic(redlands2, new SimpleMarkerSymbol(Color.RED, 15, STYLE.CIRCLE)));   map.addLayer(graphicsLayer);    Object init = getLastNonConfigurationInstance();   if (init != null) {    map.restoreState((String) init);   }  }   protected void onPause() {   super.onPause();   map.pause();  }   protected void onResume() {   super.onResume();   map.unpause();  } }