<?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: Callout for a selected point in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/callout-for-a-selected-point/m-p/499743#M3446</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try moving the lines that follow the "queryTask.execute" statement from the "doInBackground" method to the "onPostExecute" method of your AsyncTask. Hopefully the problem is limited to the issue of needing to update the GUI from only the main thread, which is performed by onPostExecute. Your sample code is missing the onPostExecute method with a FeatureSet as the incoming parameter, something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp; @Override &amp;nbsp; protected void onPostExecute(final FeatureSet result) { &amp;nbsp;&amp;nbsp; //Get an array of graphics of the query result FeatureSet &amp;nbsp;&amp;nbsp; Graphic[] resultGraphic = result.getGraphics(); &amp;nbsp;&amp;nbsp; View popupView = createPopupView(resultGraphic[0]); &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Map_view.getCallout().show(point, popupView);&amp;nbsp; &amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I currently cannot verify what is going on in the PopupInWebmapForViewing sample as my machine is throwing errors - hopefully this will gain you some progress.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 May 2013 20:41:59 GMT</pubDate>
    <dc:creator>JeffSmith8</dc:creator>
    <dc:date>2013-05-23T20:41:59Z</dc:date>
    <item>
      <title>Callout for a selected point</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/callout-for-a-selected-point/m-p/499742#M3445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to show Callout for a selected(queried by a single tap) point data (Map service).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I believe query part works fine, as I checked that attribute values of a point data are assigned to valuables.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That is, "myPopupInfo" has an expected value. However, nothing show up after that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am not sure whether "popupContent"(TextView) and "rat"(LinearLayout) are correct.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would really appreciate if anybody helped me out...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Gakumin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; @Override&amp;nbsp; protected void onCreate(Bundle savedInstanceState) { &amp;nbsp; super.onCreate(savedInstanceState); &amp;nbsp; setContentView(R.layout.map_view);&amp;nbsp; &amp;nbsp; //Set a default tap action as pop-up &amp;nbsp; Map_view.setOnSingleTapListener(new OnSingleTapListener() { &amp;nbsp;&amp;nbsp; private static final long serialVersionUID = 1L; &amp;nbsp;&amp;nbsp; public void onSingleTap(float x_v, float y_v) { &amp;nbsp;&amp;nbsp;&amp;nbsp; Point point = Map_view.toMapPoint(x_v, y_v); &amp;nbsp;&amp;nbsp;&amp;nbsp; // Tolerance: 20 pixel &amp;nbsp;&amp;nbsp;&amp;nbsp; Envelope env_v = new Envelope(point,20*Map_view.getResolution(), 20*Map_view.getResolution());&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; new setDefaultTapActions_popup(env_v, dmsl_v.getSpatialReference(), point).execute(".../MapServer/0"); &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; //Query dynamic map service layer by QueryTask(Modified from "PopupInWebmapForViewing.java")&amp;nbsp; private class setDefaultTapActions_popup extends AsyncTask&amp;lt;String, Void, FeatureSet&amp;gt; { &amp;nbsp;&amp;nbsp; &amp;nbsp; private Envelope env_v; &amp;nbsp; private SpatialReference sr; &amp;nbsp; private Point point; &amp;nbsp;&amp;nbsp; &amp;nbsp; public setDefaultTapActions_popup(Envelope env_v, SpatialReference sr, Point point) {&amp;nbsp; &amp;nbsp;&amp;nbsp; super(); &amp;nbsp;&amp;nbsp; this.env_v = env_v; &amp;nbsp;&amp;nbsp; this.sr = sr; &amp;nbsp;&amp;nbsp; this.point = point; &amp;nbsp; } &amp;nbsp;&amp;nbsp; &amp;nbsp; @Override &amp;nbsp; protected FeatureSet doInBackground(String... params) { &amp;nbsp;&amp;nbsp; //Set query parameters &amp;nbsp;&amp;nbsp; Query query = new Query(); &amp;nbsp;&amp;nbsp; query.setInSpatialReference(sr); &amp;nbsp;&amp;nbsp; query.setOutSpatialReference(sr); &amp;nbsp;&amp;nbsp; query.setGeometry(env_v); &amp;nbsp;&amp;nbsp; //For now, max number of returned features is 10. &amp;nbsp;&amp;nbsp; query.setMaxFeatures(10); &amp;nbsp;&amp;nbsp; query.setOutFields(new String[] { "*" }); &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; QueryTask queryTask = new QueryTask(".../MapServer/0"); &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; //Execute query task &amp;nbsp;&amp;nbsp; try { &amp;nbsp;&amp;nbsp;&amp;nbsp; FeatureSet fs_view = queryTask.execute(query); &amp;nbsp;&amp;nbsp;&amp;nbsp; //Get an array of graphics of the query result FeatureSet &amp;nbsp;&amp;nbsp;&amp;nbsp; Graphic[] resultGraphic = fs_view.getGraphics(); &amp;nbsp;&amp;nbsp;&amp;nbsp; View popupView = createPopupView(resultGraphic[0]); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map_view.getCallout().show(point, popupView);&amp;nbsp; &amp;nbsp;&amp;nbsp; } catch (Exception e) { &amp;nbsp;&amp;nbsp;&amp;nbsp; // TODO Auto-generated catch block &amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace(); &amp;nbsp;&amp;nbsp; }&amp;nbsp; &amp;nbsp;&amp;nbsp; // TODO Auto-generated method stub &amp;nbsp;&amp;nbsp; return null; &amp;nbsp; }&amp;nbsp; &amp;nbsp; private View createPopupView(Graphic graphic) { &amp;nbsp;&amp;nbsp; //Employ "createReportView" of "MyWater" sample of ESRI &amp;nbsp;&amp;nbsp; LinearLayout ret = new LinearLayout(context); &amp;nbsp;&amp;nbsp; ret.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LayoutParams.WRAP_CONTENT)); &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Object attribute; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; attribute = graphic.getAttributeValue("Type_Store"); &amp;nbsp;&amp;nbsp; String Type_Store = null; &amp;nbsp;&amp;nbsp; if (attribute != null){ &amp;nbsp;&amp;nbsp;&amp;nbsp; Type_Store = (String)attribute; &amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; attribute = graphic.getAttributeValue("Name_Store"); &amp;nbsp;&amp;nbsp; String Name_Store = null; &amp;nbsp;&amp;nbsp; if (attribute != null){ &amp;nbsp;&amp;nbsp;&amp;nbsp; Name_Store = (String)attribute; &amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; attribute = graphic.getAttributeValue("Open_Close"); &amp;nbsp;&amp;nbsp; String Open_Close = null; &amp;nbsp;&amp;nbsp; if (attribute != null){ &amp;nbsp;&amp;nbsp;&amp;nbsp; Open_Close = (String)attribute; &amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; attribute = graphic.getAttributeValue("Service"); &amp;nbsp;&amp;nbsp; String Service = null; &amp;nbsp;&amp;nbsp; if (attribute != null){ &amp;nbsp;&amp;nbsp;&amp;nbsp; Service = (String)attribute; &amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; attribute = graphic.getAttributeValue("AmountSup"); &amp;nbsp;&amp;nbsp; Integer AmountSup = 0; &amp;nbsp;&amp;nbsp; if (attribute != null){ &amp;nbsp;&amp;nbsp;&amp;nbsp; AmountSup = (Integer)attribute; &amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; StringBuilder myPopupInfo = new StringBuilder(); &amp;nbsp;&amp;nbsp; myPopupInfo.append("Type of Store:\t" + Type_Store); &amp;nbsp;&amp;nbsp; myPopupInfo.append("\nName of Store:\t" + Name_Store); &amp;nbsp;&amp;nbsp; myPopupInfo.append("\nOpen or Close?:\t" + Open_Close); &amp;nbsp;&amp;nbsp; myPopupInfo.append("\nService:\t" + Service); &amp;nbsp;&amp;nbsp; myPopupInfo.append("\nAmount of Supply:\t" + AmountSup); &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; TextView popupContent = new TextView(context); &amp;nbsp;&amp;nbsp; popupContent.setText(myPopupInfo.toString()); &amp;nbsp;&amp;nbsp; popupContent.setTextColor(Color.WHITE); &amp;nbsp;&amp;nbsp; popupContent.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 9); &amp;nbsp;&amp;nbsp; popupContent.setPadding(1, 0, 1, 0); &amp;nbsp;&amp;nbsp; ret.addView(popupContent); &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; // TODO Auto-generated method stub &amp;nbsp;&amp;nbsp; return ret; &amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 00:10:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/callout-for-a-selected-point/m-p/499742#M3445</guid>
      <dc:creator>GakuminKato</dc:creator>
      <dc:date>2013-05-23T00:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Callout for a selected point</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/callout-for-a-selected-point/m-p/499743#M3446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try moving the lines that follow the "queryTask.execute" statement from the "doInBackground" method to the "onPostExecute" method of your AsyncTask. Hopefully the problem is limited to the issue of needing to update the GUI from only the main thread, which is performed by onPostExecute. Your sample code is missing the onPostExecute method with a FeatureSet as the incoming parameter, something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp; @Override &amp;nbsp; protected void onPostExecute(final FeatureSet result) { &amp;nbsp;&amp;nbsp; //Get an array of graphics of the query result FeatureSet &amp;nbsp;&amp;nbsp; Graphic[] resultGraphic = result.getGraphics(); &amp;nbsp;&amp;nbsp; View popupView = createPopupView(resultGraphic[0]); &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Map_view.getCallout().show(point, popupView);&amp;nbsp; &amp;nbsp; }&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I currently cannot verify what is going on in the PopupInWebmapForViewing sample as my machine is throwing errors - hopefully this will gain you some progress.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 May 2013 20:41:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/callout-for-a-selected-point/m-p/499743#M3446</guid>
      <dc:creator>JeffSmith8</dc:creator>
      <dc:date>2013-05-23T20:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Callout for a selected point</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/callout-for-a-selected-point/m-p/499744#M3447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi jsmithgisguy2,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you so much for your advice! I will definitely give it a try shortly! (I am currently running into another issue in different part as well...) Then, I will report the result to you and community here. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Gakumin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Try moving the lines that follow the "queryTask.execute" statement from the "doInBackground" method to the "onPostExecute" method of your AsyncTask. Hopefully the problem is limited to the issue of needing to update the GUI from only the main thread, which is performed by onPostExecute. Your sample code is missing the onPostExecute method with a FeatureSet as the incoming parameter, something like:&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp; @Override
&amp;nbsp; protected void onPostExecute(final FeatureSet result) {
&amp;nbsp;&amp;nbsp; //Get an array of graphics of the query result FeatureSet
&amp;nbsp;&amp;nbsp; Graphic[] resultGraphic = result.getGraphics();
&amp;nbsp;&amp;nbsp; View popupView = createPopupView(resultGraphic[0]);
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; Map_view.getCallout().show(point, popupView);

&amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I currently cannot verify what is going on in the PopupInWebmapForViewing sample as my machine is throwing errors - hopefully this will gain you some progress.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:56:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/callout-for-a-selected-point/m-p/499744#M3447</guid>
      <dc:creator>GakuminKato</dc:creator>
      <dc:date>2021-12-11T21:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Callout for a selected point</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/callout-for-a-selected-point/m-p/499745#M3448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi jsmithgisguy2,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you so much for your help! Your advise worked in my code!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;My updated code does query in "doInBackground" and pass the result, view, to "doInBackground".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, callout showed up! I really appreciate your help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I attached the updated code here for reference. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Gakumin&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
 //Query dynamic map service layer by QueryTask(Modified from "PopupInWebmapForViewing.java")
 private class setDefaultTapActions_popup extends AsyncTask&amp;lt;String, Void, View&amp;gt; {
&amp;nbsp; 
&amp;nbsp; private Envelope env_v;
&amp;nbsp; private SpatialReference sr;
&amp;nbsp; private Point point;
&amp;nbsp; 
&amp;nbsp; public setDefaultTapActions_popup(Envelope env_v, SpatialReference sr, Point point) { 
&amp;nbsp;&amp;nbsp; super();
&amp;nbsp;&amp;nbsp; this.env_v = env_v;
&amp;nbsp;&amp;nbsp; this.sr = sr;
&amp;nbsp;&amp;nbsp; this.point = point;
&amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; @Override
&amp;nbsp; protected View doInBackground(String... params) {
&amp;nbsp;&amp;nbsp; //Set query parameters
&amp;nbsp;&amp;nbsp; Query query = new Query();
&amp;nbsp;&amp;nbsp; query.setInSpatialReference(sr);
&amp;nbsp;&amp;nbsp; query.setOutSpatialReference(sr);
&amp;nbsp;&amp;nbsp; query.setGeometry(env_v);
&amp;nbsp;&amp;nbsp; //For now, max number of returned features is 10.
&amp;nbsp;&amp;nbsp; query.setMaxFeatures(10);
&amp;nbsp;&amp;nbsp; query.setOutFields(new String[] { "*" });
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; QueryTask queryTask = new QueryTask("...../MapServer/0");
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; //Execute query task
&amp;nbsp;&amp;nbsp; try {
&amp;nbsp;&amp;nbsp;&amp;nbsp; FeatureSet fs_view = queryTask.execute(query);
&amp;nbsp;&amp;nbsp;&amp;nbsp; //Get an array of graphics of the query result FeatureSet
&amp;nbsp;&amp;nbsp;&amp;nbsp; Graphic[] resultGraphic = fs_view.getGraphics();
&amp;nbsp;&amp;nbsp;&amp;nbsp; View popupView = createPopupView(resultGraphic[0]);
&amp;nbsp;&amp;nbsp; } catch (Exception e) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // TODO Auto-generated catch block
&amp;nbsp;&amp;nbsp;&amp;nbsp; e.printStackTrace();
&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp; // TODO Auto-generated method stub
&amp;nbsp;&amp;nbsp; return null;
&amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; @Override
&amp;nbsp; protected void onPostExecute(View popupView) {
&amp;nbsp;&amp;nbsp; // TODO Auto-generated method stub
&amp;nbsp;&amp;nbsp; super.onPostExecute(popupView);
&amp;nbsp;&amp;nbsp; Callout callout = Map_view.getCallout();
&amp;nbsp;&amp;nbsp; callout.setStyle(R.xml.callout_style);
&amp;nbsp;&amp;nbsp; callout.setContent(popupView);
&amp;nbsp;&amp;nbsp; callout.show(point);
&amp;nbsp; }
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:57:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/callout-for-a-selected-point/m-p/499745#M3448</guid>
      <dc:creator>GakuminKato</dc:creator>
      <dc:date>2021-12-11T21:57:02Z</dc:date>
    </item>
  </channel>
</rss>

