Android ESRI映射获取无法为图形错误生成序列

Android ESRI映射获取无法为图形错误生成序列,android,esri,Android,Esri,我使用以下代码在ESRI地图中添加图形层 public void footprintdata(String option) { graphicsLayer.removeAll(); if(option.equalsIgnoreCase("ALL")) { try { Graphic[] resultGraphics = new Graphic[footprintdata.size()]; // Envelope to focus on t

我使用以下代码在ESRI地图中添加图形层

public void footprintdata(String option)
 {  
  graphicsLayer.removeAll();

  if(option.equalsIgnoreCase("ALL"))
  {
   try 
   {    
    Graphic[] resultGraphics = new Graphic[footprintdata.size()];
    // Envelope to focus on the map extent on the results
    Envelope extent = new Envelope();

    for (i = 0; i < footprintdata.size(); i++) 
    {
     double lattitude = 0.0;
     double longitude = 0.0;  

     if(!footprintdata.get(i).getLatitude().equalsIgnoreCase(""))
     {
      lattitude = Double.parseDouble(footprintdata.get(i).getLatitude());
     }
     if(!footprintdata.get(i).getLongitude().equalsIgnoreCase(""))
     {
      longitude = Double.parseDouble(footprintdata.get(i).getLongitude());
     }     

     mLocation = new Point(XCoordinateFromLongitude(longitude), YCoordinateFromLatitude(lattitude));

     mapPoint = (Point) GeometryEngine.project(mLocation,
       SpatialReference.create(4326),mapView.getSpatialReference());  

     SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 20, SimpleMarkerSymbol.STYLE.DIAMOND);
     // create graphic object for resulting location
     //PictureMarkerSymbol imagesymbolicon = new PictureMarkerSymbol(imagemarker(i));

     Graphic resultgraphics = new Graphic(mapPoint,resultSymbol);    
     resultGraphics[i] = resultgraphics;
     extent.merge(mapPoint);
    }

    graphicsLayer.addGraphics(resultGraphics);
    mapView.setExtent(extent, 100);
    mapView.zoomToResolution(mapPoint, 10);
    mapView.invalidate();


   } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
  }
  else
  {

   System.out.println("else of spinner selection");

   try 
   {    
    int count = 0;
    int temp = 1;
    for (int i = 0; i < footprintdata.size(); i++) {

     if (footprintdata.get(i).getLocationtype()
       .equalsIgnoreCase(spinner.getSelectedItem().toString())) {

      count++;
     }
    }

    System.out.println("count :"+ count);
    Graphic[] resultGraphics = new Graphic[count];
    Envelope extent = new Envelope(); 

    for (int i = 0; i < footprintdata.size(); i++) {

     //PictureMarkerSymbol imagesymbol = null;
     if (footprintdata.get(i).getLocationtype()
       .equalsIgnoreCase(spinner.getSelectedItem().toString())) {

      System.out.println("result success : "
        + footprintdata.get(i).getLocationtype());

      double lattitude = Double
      .parseDouble(footprintdata.get(i)
        .getLatitude());
      double longitude = Double
      .parseDouble(footprintdata.get(i) 
        .getLongitude());

      mLocation = new Point(XCoordinateFromLongitude(longitude), YCoordinateFromLatitude(lattitude));

      mapPoint = (Point) GeometryEngine.project(mLocation,
        SpatialReference.create(4326),mapView.getSpatialReference());

      SimpleMarkerSymbol resultSymbol = new SimpleMarkerSymbol(Color.GREEN, 20, SimpleMarkerSymbol.STYLE.DIAMOND);

      //PictureMarkerSymbol imagesymbolicon = new PictureMarkerSymbol(imagemarker(i));
      Graphic resultLocation = new Graphic(mapPoint,resultSymbol);

      System.out.println("temp :"+ temp);
      resultGraphics[temp] = resultLocation;
      extent.merge(mapPoint);
      temp++;

     }
    }

    graphicsLayer.addGraphics(resultGraphics);
    mapView.setExtent(extent, 100);
    mapView.zoomToResolution(mapPoint, 10);
    mapView.invalidate();    

   } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
  }
 }


public double YCoordinateFromLatitude(double latitude)
    {
        double rad = latitude * 0.0174532;
        double fsin = Math.sin(rad);
        double y = 6378137 / 2.0 * Math.log((1.0 + fsin) / (1.0 - fsin));

        return y;
    }   

    public double XCoordinateFromLongitude(double longitude)
    {
        double x = longitude * 0.017453292519943 * 6378137;
        return x;
    }
public void footprintdata(字符串选项)
{  
graphicsLayer.removeAll();
if(option.equalsIgnoreCase(“全部”))
{
尝试
{    
Graphic[]resultGraphics=新图形[footprintdata.size()];
//包络线以聚焦结果上的贴图范围
信封范围=新信封();
对于(i=0;i
这段代码在第一次运行时效果很好。但是在它之后,我得到了
MapCore(24187):无法在我的Logcat中为图形生成序列。

如果有人对此有任何想法,请提供帮助。

我通过删除以下两种方法解决了此问题:-

public double YCoordinateFromLatitude(double latitude)
    {
        double rad = latitude * 0.0174532;
        double fsin = Math.sin(rad);
        double y = 6378137 / 2.0 * Math.log((1.0 + fsin) / (1.0 - fsin));

        return y;
    }   

    public double XCoordinateFromLongitude(double longitude)
    {
        double x = longitude * 0.017453292519943 * 6378137;
        return x;
    }
这两种方法在IOS上运行良好,但在Android上,我使用了以下几行

mLocation = new Point(longitude,lattitude);
而不是这个

mLocation = new Point(XCoordinateFromLongitude(longitude), YCoordinateFromLatitude(lattitude));
这就解决了我的问题