<?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 Check if user clicked on graphic in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/check-if-user-clicked-on-graphic/m-p/24911#M174</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need some advice from you on the best practices of using the android API. I have 3 graphic layers and 2 feature layer in my application. Now when the user taps on a graphic in the map, I want to display a callout with relevant details. Going through the ESRI api, there is a function called graphicsLayer.getGraphicIDS(x,y,tolerance) which can give me the graphic, but problem is I have no way on knowing which layer, the graphic belongs to. Now I am doing somthing like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;map.setOnSingleTapListenere( new onSingleTapListener(pointX,pointY){&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if((graphicsLayer1.getGraphicIDs(x,y,tolerance)).length==0){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // inflate callout and show&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }else if((graphicsLayer2.getGraphicIDs(x,y,tolerance)).length==0){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // inflate callout and show&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }else if((graphicsLayer3.getGraphicIDs(x,y,tolerance)).length==0){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // inflate callout and show&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }else&amp;nbsp; if((featurelayer1.getGraphicIDs(x,y,tolerance)).length==0){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // inflate callout and show&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }else&amp;nbsp; if((featurelayer2.getGraphicIDs(x,y,tolerance)).length==0){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // inflate callout and show&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this the best way to handle this situation?Seems like a lot of work for a seemily basic map operation so I feel I am doing something wrong. Please advice.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 06 Aug 2013 07:40:58 GMT</pubDate>
    <dc:creator>ThomasBinu</dc:creator>
    <dc:date>2013-08-06T07:40:58Z</dc:date>
    <item>
      <title>Check if user clicked on graphic</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/check-if-user-clicked-on-graphic/m-p/24911#M174</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need some advice from you on the best practices of using the android API. I have 3 graphic layers and 2 feature layer in my application. Now when the user taps on a graphic in the map, I want to display a callout with relevant details. Going through the ESRI api, there is a function called graphicsLayer.getGraphicIDS(x,y,tolerance) which can give me the graphic, but problem is I have no way on knowing which layer, the graphic belongs to. Now I am doing somthing like this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;map.setOnSingleTapListenere( new onSingleTapListener(pointX,pointY){&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if((graphicsLayer1.getGraphicIDs(x,y,tolerance)).length==0){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // inflate callout and show&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }else if((graphicsLayer2.getGraphicIDs(x,y,tolerance)).length==0){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // inflate callout and show&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }else if((graphicsLayer3.getGraphicIDs(x,y,tolerance)).length==0){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // inflate callout and show&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }else&amp;nbsp; if((featurelayer1.getGraphicIDs(x,y,tolerance)).length==0){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // inflate callout and show&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }else&amp;nbsp; if((featurelayer2.getGraphicIDs(x,y,tolerance)).length==0){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // inflate callout and show&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;});&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this the best way to handle this situation?Seems like a lot of work for a seemily basic map operation so I feel I am doing something wrong. Please advice.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Aug 2013 07:40:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/check-if-user-clicked-on-graphic/m-p/24911#M174</guid>
      <dc:creator>ThomasBinu</dc:creator>
      <dc:date>2013-08-06T07:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Check if user clicked on graphic</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/check-if-user-clicked-on-graphic/m-p/24912#M175</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thomas,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think you are very close to the answer. Yes, getGraphicIDs(x,y,tolerance) is the best way to retrieve graphics locally based on an OnSingleTapEvent. The only alternative is you would have make one or multiple round-trip requests to ArcGIS Server depending on how many services you needed to Query.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Taking your example, you could create&amp;nbsp; an Array of all graphics returned and display them in a &lt;/SPAN&gt;&lt;A href="http://developer.android.com/guide/topics/ui/layout/listview.html"&gt;ListView&lt;/A&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Within your array just make sure to store which layer the info came from such as featureLayer1, graphicsLayer1, etc along with the attributes of the Graphic. This helps you deal with the use case of having multiple graphics returned. It also allows the user to decide which graphic was the one they wanted to view.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2) You could allow the user to toggle layers on/off so that the search is narrowed down to one layer at a time. When working with multiple feature layers this is one of the most common approaches.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Andy&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Aug 2013 15:27:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/check-if-user-clicked-on-graphic/m-p/24912#M175</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2013-08-06T15:27:27Z</dc:date>
    </item>
  </channel>
</rss>

