<?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 Re: ArcGIS Feature Layer with Callouts not working properly in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/arcgis-feature-layer-with-callouts-not-working/m-p/280039#M1838</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So, apparently the way I have my callout set up the callout only works with the last ArcGIS feature layer that is added.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So in my code above fLayer was added last, thus the callout worked for that layer. I switched it to have fLayer1 added last and the callout only worked that layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I modify the callout to work on all three layers?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 12 Jul 2013 16:52:56 GMT</pubDate>
    <dc:creator>JohnAllen</dc:creator>
    <dc:date>2013-07-12T16:52:56Z</dc:date>
    <item>
      <title>ArcGIS Feature Layer with Callouts not working properly</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/arcgis-feature-layer-with-callouts-not-working/m-p/280038#M1837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have one map document with the same layer added three times, each layer has a different color symbol. I published the map as a map service on our server. In my app I call each layer from the map service separately, each as ArcGIS Feature Layers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I open the map all three ArcGIS Feature layers appear.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Next, I have a callout set-up in my app. When you click on a point from one of the feature layers the callout is suppose to appear for each of the three feature layers, BUT the callout only appears for one of them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The reason I set-up the app this way is because I initially had one ArcGIS feature layer with a callout and everything worked fine. Then, I needed to be able to turn different colored dots off, so thats when I went back and added the same layer three times with different colored dots for each in my published map document, then I called those layers separately in my app, now only one of the layers callouts work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Only callouts for flayer are working.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Java Code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
public class Mapscreen extends Activity {

 public MapView map;&amp;nbsp; 
&amp;nbsp; 
 //Callout Variables
 private int m_calloutStyle;
 private Callout m_callout;
 private ViewGroup calloutContent;
 private Graphic m_identifiedGraphic;
 ArcGISFeatureLayer fLayer;
 ArcGISFeatureLayer fLayer1;
 ArcGISFeatureLayer fLayer2;
 ImageView CallOutClose;
 
 //Basemap Variables.
 ArcGISTiledMapServiceLayer basemapImagery;
 ArcGISTiledMapServiceLayer basemapTopo;

 /** Called when the activity is first created. */
 public void onCreate(Bundle savedInstanceState) {
&amp;nbsp; // Initial activity content view. (START)
&amp;nbsp; super.onCreate(savedInstanceState);
&amp;nbsp; setContentView(R.layout.mapscreen);

&amp;nbsp; // Retrieve the map layout and initial extent from mapscreen XML layout.
&amp;nbsp; map = (MapView) findViewById(R.id.map);&amp;nbsp;&amp;nbsp; 
&amp;nbsp; 
&amp;nbsp; // Get basemaps
&amp;nbsp; basemapTopo = new ArcGISTiledMapServiceLayer(this.getResources().getString(R.string.WORLD_TOPO_MAP));
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; // Add basemaps
&amp;nbsp; map.addLayer(basemapTopo); 
&amp;nbsp; 
&amp;nbsp; // Get feature layer = Blue = No
&amp;nbsp; String URL = "http://...../MapServer/2";
&amp;nbsp; final ArcGISFeatureLayer fLayer2 = new ArcGISFeatureLayer(URL, MODE.ONDEMAND);
&amp;nbsp; 
&amp;nbsp; // Get feature layer = Yellow = Unknown
&amp;nbsp; String URL1 = "http://...../MapServer/1";
&amp;nbsp; final ArcGISFeatureLayer fLayer1 = new ArcGISFeatureLayer(URL1, MODE.ONDEMAND);
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; // Get feature layer = Green = Yes
&amp;nbsp; String URL2 = "http://...../MapServer/0";
&amp;nbsp; final ArcGISFeatureLayer fLayer = new ArcGISFeatureLayer(URL2, MODE.ONDEMAND);
&amp;nbsp; 
&amp;nbsp; // Add feature layers
&amp;nbsp; map.addLayer(fLayer2);
&amp;nbsp; map.addLayer(fLayer1);
&amp;nbsp; map.addLayer(fLayer);&amp;nbsp; 

&amp;nbsp; // This puts the ERSI logo on the bottom left corner of the screen once the map screen appears. This is mandatory by
&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; ESRI.
&amp;nbsp; map.setEsriLogoVisible(true);&amp;nbsp; 
&amp;nbsp; 
&amp;nbsp; LayoutInflater inflater = getLayoutInflater();
&amp;nbsp; // Get the MapView's callout from xml-&amp;gt;identify_calloutstyle.xml
&amp;nbsp; m_calloutStyle = R.xml.facility_calloutstyle;
&amp;nbsp; // Get the layout for the Callout from layout-&amp;gt;identify_callout_content.xml
&amp;nbsp; calloutContent = (ViewGroup) inflater.inflate(R.layout.facility_callout_content, null);&amp;nbsp; 
&amp;nbsp; 
&amp;nbsp; m_callout = map.getCallout();&amp;nbsp; 
&amp;nbsp; m_callout.setContent(calloutContent);&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; //Callout Part - 1
&amp;nbsp; map.setOnSingleTapListener(new OnSingleTapListener() {

&amp;nbsp;&amp;nbsp; private static final long serialVersionUID = 1L;

&amp;nbsp;&amp;nbsp; @Override
&amp;nbsp;&amp;nbsp; public void onSingleTap(float x, float y) {

&amp;nbsp;&amp;nbsp;&amp;nbsp; if (m_isMapLoaded) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // If map is initialized and Single tap is registered on screen identify the location selected
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; identifyLocation(x, y);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
// Initial activity content view. (END)

//Callout Part - 2
 /**
&amp;nbsp; * Takes in the screen location of the point to identify the feature on map.
&amp;nbsp; * 
&amp;nbsp; * @param x
&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x co-ordinate of point
&amp;nbsp; * @param y
&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y co-ordinate of point
&amp;nbsp; */
 private void identifyLocation(float x, float y) {

&amp;nbsp; // Hide the callout, if the callout from previous tap is still showing on map
&amp;nbsp; if (m_callout.isShowing()) {
&amp;nbsp;&amp;nbsp; m_callout.hide();
&amp;nbsp; }

&amp;nbsp; // Find out if the user tapped on a feature
&amp;nbsp; SearchForFeature(x, y);

&amp;nbsp; // If the user tapped on a feature, then display information regarding the feature in the callout
&amp;nbsp; if (m_identifiedGraphic != null) {
&amp;nbsp;&amp;nbsp; Point mapPoint = map.toMapPoint(x, y);
&amp;nbsp;&amp;nbsp; // Show Callout
&amp;nbsp;&amp;nbsp; ShowCallout(m_callout, m_identifiedGraphic, mapPoint);
&amp;nbsp;&amp;nbsp; //Close button for the callout is initiated here.
&amp;nbsp;&amp;nbsp; ImageView CallOutClose = (ImageView) findViewById(R.id.callout_close_button);
&amp;nbsp;&amp;nbsp; CallOutClose.setOnClickListener(new View.OnClickListener() {
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; @Override
&amp;nbsp;&amp;nbsp;&amp;nbsp; public void onClick(View v) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_callout.hide();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; });
&amp;nbsp; }
 }
 
 //Callout Part - 3
 /**
&amp;nbsp; * Sets the value of m_identifiedGraphic to the Graphic present on the
&amp;nbsp; * location of screen tap
&amp;nbsp; * 
&amp;nbsp; * @param x
&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x co-ordinate of point
&amp;nbsp; * @param y
&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y co-ordinate of point
&amp;nbsp; */
 private void SearchForFeature(float x, float y) {

&amp;nbsp; Point mapPoint = map.toMapPoint(x, y);

&amp;nbsp; if (mapPoint != null) {

&amp;nbsp;&amp;nbsp; for (Layer layer : map.getLayers()) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (layer == null)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue;

&amp;nbsp;&amp;nbsp;&amp;nbsp; if (layer instanceof ArcGISFeatureLayer) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ArcGISFeatureLayer fLayer = (ArcGISFeatureLayer) layer;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the Graphic at location x,y
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m_identifiedGraphic = GetFeature(fLayer, x, y);
&amp;nbsp;&amp;nbsp;&amp;nbsp; } else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; continue;
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
 }
 
 //Callout Part - 4
 /**
&amp;nbsp; * Returns the Graphic present the location of screen tap
&amp;nbsp; * 
&amp;nbsp; * @param fLayer
&amp;nbsp; * @param x
&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x co-ordinate of point
&amp;nbsp; * @param y
&amp;nbsp; *&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y co-ordinate of point
&amp;nbsp; * @return Graphic at location x,y
&amp;nbsp; */
 private Graphic GetFeature(ArcGISFeatureLayer fLayer, float x, float y) {

&amp;nbsp; // Get the graphics near the Point.
&amp;nbsp; int[] ids = fLayer.getGraphicIDs(x, y, 10, 1);
&amp;nbsp; if (ids == null || ids.length == 0) {
&amp;nbsp;&amp;nbsp; return null;
&amp;nbsp; }
&amp;nbsp; Graphic g = fLayer.getGraphic(ids[0]);
&amp;nbsp; return g;
 }
 
 //Callout Part - 5
 /**
&amp;nbsp; * Shows the Attribute values for the Graphic in the Callout
&amp;nbsp; * 
&amp;nbsp; * @param calloutView
&amp;nbsp; * @param graphic
&amp;nbsp; * @param mapPoint
&amp;nbsp; */
 private void ShowCallout(Callout calloutView, Graphic graphic, Point mapPoint) {

&amp;nbsp; // Get the values of attributes for the Graphic
&amp;nbsp; String Name = (String) graphic.getAttributeValue("Name");
&amp;nbsp; String Phone = (String) graphic.getAttributeValue("Phone"); 

&amp;nbsp; // Set callout properties
&amp;nbsp; calloutView.setCoordinates(mapPoint);
&amp;nbsp; calloutView.setStyle(m_calloutStyle);
&amp;nbsp; calloutView.setMaxWidth(700);
&amp;nbsp; calloutView.setMaxHeight(500);

&amp;nbsp; TextView calloutTextLine0 = (TextView) findViewById(R.id.callout_content_textview0);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; calloutTextLine0.setText("Name:" + " " + Name);
&amp;nbsp; 
&amp;nbsp; TextView calloutTextLine1 = (TextView) findViewById(R.id.callout_content_textview1); 
&amp;nbsp; calloutTextLine1.setMovementMethod(LinkMovementMethod.getInstance());
&amp;nbsp; calloutTextLine1.setText("Phone:" + " " + Phone);
&amp;nbsp; 
&amp;nbsp; calloutView.show();
 }&amp;nbsp; 


&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 14:41:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/arcgis-feature-layer-with-callouts-not-working/m-p/280038#M1837</guid>
      <dc:creator>JohnAllen</dc:creator>
      <dc:date>2013-07-12T14:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Feature Layer with Callouts not working properly</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/arcgis-feature-layer-with-callouts-not-working/m-p/280039#M1838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So, apparently the way I have my callout set up the callout only works with the last ArcGIS feature layer that is added.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So in my code above fLayer was added last, thus the callout worked for that layer. I switched it to have fLayer1 added last and the callout only worked that layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I modify the callout to work on all three layers?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Jul 2013 16:52:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/arcgis-feature-layer-with-callouts-not-working/m-p/280039#M1838</guid>
      <dc:creator>JohnAllen</dc:creator>
      <dc:date>2013-07-12T16:52:56Z</dc:date>
    </item>
  </channel>
</rss>

