<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to zoom to a query result in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-zoom-to-a-query-result/m-p/352079#M2273</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;I'm working on developing an application using ArcGIS Runtime SDK for Android.&lt;/P&gt;&lt;P&gt;I created number of web maps in ArcGIS Online&amp;nbsp; and the application uses these&lt;/P&gt;&lt;P&gt;web maps as source layers. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I make a query in map viewer&amp;nbsp; in ArcGIS Online, the zoom level is changed and&amp;nbsp; the selected feature(s) &lt;/P&gt;&lt;P&gt;are centered. However, when I try the same thing in my application, the result is not the same. &lt;/P&gt;&lt;P&gt;The following piece of code is written to perform such operation but apparently I missed&lt;/P&gt;&lt;P&gt;something.&amp;nbsp; &lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;mMapView.setOnStatusChangedListener(new OnStatusChangedListener() {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static final long serialVersionUID = 1L;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void onStatusChanged(Object source, STATUS status) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (source == URL &amp;amp;&amp;amp; status == STATUS.LAYER_LOADED) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mMapView.centerAt(1.286389, 103.79, false);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mMapView.setScale(1500, false);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be great if you could help me on this issue.&amp;nbsp; Thank you in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 20 Feb 2016 22:19:58 GMT</pubDate>
    <dc:creator>FatmaŞenol</dc:creator>
    <dc:date>2016-02-20T22:19:58Z</dc:date>
    <item>
      <title>How to zoom to a query result</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-zoom-to-a-query-result/m-p/352079#M2273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, &lt;/P&gt;&lt;P&gt;I'm working on developing an application using ArcGIS Runtime SDK for Android.&lt;/P&gt;&lt;P&gt;I created number of web maps in ArcGIS Online&amp;nbsp; and the application uses these&lt;/P&gt;&lt;P&gt;web maps as source layers. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I make a query in map viewer&amp;nbsp; in ArcGIS Online, the zoom level is changed and&amp;nbsp; the selected feature(s) &lt;/P&gt;&lt;P&gt;are centered. However, when I try the same thing in my application, the result is not the same. &lt;/P&gt;&lt;P&gt;The following piece of code is written to perform such operation but apparently I missed&lt;/P&gt;&lt;P&gt;something.&amp;nbsp; &lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;mMapView.setOnStatusChangedListener(new OnStatusChangedListener() {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static final long serialVersionUID = 1L;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void onStatusChanged(Object source, STATUS status) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (source == URL &amp;amp;&amp;amp; status == STATUS.LAYER_LOADED) {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mMapView.centerAt(1.286389, 103.79, false);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mMapView.setScale(1500, false);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would be great if you could help me on this issue.&amp;nbsp; Thank you in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Feb 2016 22:19:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-zoom-to-a-query-result/m-p/352079#M2273</guid>
      <dc:creator>FatmaŞenol</dc:creator>
      <dc:date>2016-02-20T22:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to zoom to a query result</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-zoom-to-a-query-result/m-p/352080#M2274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you might have a few steps missing. First, depending on your layer type, you need to query for the feature (&lt;A href="https://developers.arcgis.com/android/api-reference/reference/com/esri/core/tasks/query/QueryTask.html"&gt;QueryTask&lt;/A&gt; is probably the best place to start if its a feature layer or map service layer in your webmap). If this is a predefined query configured in your webmap, you might also need to get parameters from the &lt;A href="https://developers.arcgis.com/android/api-reference/reference/com/esri/core/portal/WebMap.html#getPredefinedQueries()"&gt;predefined queries parameter&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you have executed a query, you can then use the methods you used above on the mapview (centre at, set scale) to zoom to the features geometry in the query result/s. You may also want to select the feature (if using a feature layer) through the &lt;A href="https://developers.arcgis.com/android/api-reference/reference/com/esri/android/map/ags/ArcGISFeatureLayer.html#setSelectedGraphics(int[], boolean)"&gt;selectGraphics&lt;/A&gt; method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following samples may help you:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/QueryCloudFeatureService" title="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/QueryCloudFeatureService"&gt;arcgis-runtime-samples-android/QueryCloudFeatureService at master · Esri/arcgis-runtime-samples-android · GitHub&lt;/A&gt; &lt;A href="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/QueryCloudFeatureService" title="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/QueryCloudFeatureService"&gt;&lt;BR /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/QueryTask" title="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/QueryTask"&gt;arcgis-runtime-samples-android/QueryTask at master · Esri/arcgis-runtime-samples-android · GitHub&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2016 22:36:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/how-to-zoom-to-a-query-result/m-p/352080#M2274</guid>
      <dc:creator>WillCrick</dc:creator>
      <dc:date>2016-03-28T22:36:19Z</dc:date>
    </item>
  </channel>
</rss>

