AnsweredAssumed Answered

Initial extent from OnCreate method issue

Question asked by jesusesricurso on Jun 12, 2012
Latest reply on Jun 19, 2012 by jesusesricurso
Hi everybody,

    i've started with ESRI api for Android a few days ago. I'm trying to set an extent from a Point just when the map is initialized. I'm doing with this code:

map.setOnStatusChangedListener(new OnStatusChangedListener() {
  
   /**
    *
    */
   private static final long serialVersionUID = 1L;

   public void onStatusChanged(Object source, STATUS status) {
    if(OnStatusChangedListener.STATUS.LAYER_LOADED == status && source == map){
     Log.d("Milog", "y cambia en el mapa!!!");
     Point punto = GeometryEngine.project(-4.726584,
             41.5698, webMercator);
           map.setExtent(punto, 10);
    
    }
   }
  });

But this is not working. If i set the 'map.setExtent(punto, 10)' in a click button event it works fine. I think that my problem is related to the map is not really initialized when i try to set the extent.

Any idea? Thank's in advance.

Outcomes