首页 > 解决方案 > 想要使用 ArcGIS Runtime API for Andriod 仅在现有图形叠加层中显示第一个结果

问题描述

我目前正在使用 ESRI 地理编码服务创建定位器任务的 android 平台,并将地址传递给地理编码。

操作完成后,将检索结果位置并将其显示在图形叠加中。

我有多个输出,但我想在地图上显示第一个结果。

下面是我的代码,有没有办法改进我的代码以仅在加载时显示第一个结果而忽略休息。使过程更快。

final LocatorTask onlineLocator = new LocatorTask("https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer");
final ListenableFuture> geocodeFuture = onlineLocator.geocodeAsync("380 New York Street, Redlands, CA");
geocodeFuture.addDoneListener(new Runnable() {
  @Override
  public void run() {
    try {
      // Get the results of the async operation
      List geocodeResults = geocodeFuture.get();   
    }
    catch (InterruptedException | ExecutionException e) {
      dealWithException(e); // deal with exception appropriately...
    }
  }
});

标签: arcgisarcgis-serverarcgis-runtimearcgis-android-api

解决方案


推荐阅读