callout doesn't move with map zoom in/out

3934
8
12-16-2013 08:33 PM
8 Replies
SandeepG_S
New Contributor III
Please help me anyone.
0 Kudos
AndyGup
Esri Regular Contributor
Hi, can you please provide some additional information just to make sure we are talking about the same thing. This issue may be a duplicate of this on-going post here: http://forums.arcgis.com/threads/51928-Callout-doesn-t-move-with-MapView.centerAt


- Which version of the ArcGIS Runtime SDK for Android are you running?
- Are you using a "web map" or your own tiled map service?
- Can you provide a snippet of code?

-Andy
0 Kudos
SandeepG_S
New Contributor III
Hi, can you please provide some additional information just to make sure we are talking about the same thing. This issue may be a duplicate of this on-going post here: http://forums.arcgis.com/threads/51928-Callout-doesn-t-move-with-MapView.centerAt


- Which version of the ArcGIS Runtime SDK for Android are you running?
- Are you using a "web map" or your own tiled map service?
- Can you provide a snippet of code?

-Andy


Hi Andy, first of all thanks for the reply.The duplicate post you shared is little different from the my posting.Here i am able to show the call out but while zooming in/out the call out does't position itself with respect to the pin.it stays at the same position.

- I am using 10.2 version SDK of Arcgis.
- I am using tiled map service(i guess) as i use new ArcGISTiledMapServiceLayer(URL) for showing a map.
- below is the code snippet for showing a callout on tapping of the pin.

/***
     * Shows popup call out on the map pin
     * 
     * @param x
     * @param y
     */
    private void showCallout(float x, float y) {
        int[] uids = mGraphicLayer.getGraphicIDs(x, y, 2);
        if (uids != null && uids.length > 0) {

            int targetId = uids[0];
            Graphic gr = mGraphicLayer.getGraphic(targetId);
            mapPinCallout = mArcGisMapView.getCallout();

            if (gr != null) {
                isSingleTap = true;
                String[] content = null;
                String[] keys = gr.getAttributeNames();
                if (((String) gr.getAttributeValue(keys[0])).contains("-")) {
                    content = ((String) gr.getAttributeValue(keys[0])).split("-");
                } else if (((String) gr.getAttributeValue(keys[0])).contains(",")) {
                    content = ((String) gr.getAttributeValue(keys[0])).split(",");
                    y = (float) (Double.parseDouble(keys[0]) - (symbolHt / 2));

                }

                // Sets Callout style
                // mapPinCallout.setStyle(R.xml.countypop);

                if (content != null) {
                    // Sets custom content view to Callout
                    if (content.length > 1) {
                        mapPinCallout.show(mArcGisMapView.toScreenPoint(new Point(x, y)), loadView(content[0], content[1]));
                    } else {
                        // mapPinCallout.setContent(loadView(content[0], ""));
                        mapPinCallout.show(mArcGisMapView.toMapPoint(new Point(x, y)), loadView(content[0], ""));
                    }
                }

                calloutPoint = mArcGisMapView.toMapPoint(new Point(x, y));
                mapPinCallout.setCoordinates(calloutPoint);
                mapPinCallout.refresh();
            } else {
                hideCallout();
            }
        } else {
            hideCallout();
        }

    }


county.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<calloutViewStyle
 titleTextColor="#ffffff"
 titleTextSize="20"
 titleTextStyle="1"
 titleTextTypeface="serif"
 backgroundColor="#ffffff"
 backgroundAlpha="255"
 frameColor="#ffffff" 
 cornerCurve="10"  
 anchor="5" />
</resources>
0 Kudos
DanO_Neill
Occasional Contributor III
You should not need to manage the movement of the callout once it is set the coordinates with the show() method.  Try removing the Callout.setCoordinates() and Callout.refresh() methods.  Refer to the SymbolizingResults sample to see how the Callout holds on the initial position.
0 Kudos
SandeepG_S
New Contributor III
You should not need to manage the movement of the callout once it is set the coordinates with the show() method.  Try removing the Callout.setCoordinates() and Callout.refresh() methods.  Refer to the SymbolizingResults sample to see how the Callout holds on the initial position.


I had already tried removing Callout.setCoordinates() and Callout.refresh() methods but it did work.Is this a bug in the SDK itself?I checked  the SymbolizingResults sample and code the same way but not luck.
0 Kudos
SandeepG_S
New Contributor III
I have made some changes to the example SymbolizingResults to see the behaviour even that is buggy.
0 Kudos
EricBader
Occasional Contributor III
0 Kudos
SandeepG_S
New Contributor III
Thanks a lot for your attentions guys.Gary has helped me and i have resolved the issue.
0 Kudos