Select to view content in your preferred language

Function to detect touch on pin graphics

3117
3
10-16-2012 08:53 AM
ThomasBinu
Deactivated User
Hi guys,

I am trying to create a an application similar to the UC2012 android application by ESRI. I show some relevant places in an ERSI map using some pin graphics. Now i want to create a callout when the use touches these 'pins' similar to UC2012 app. I am able to display a callout at random points specifed through code and I know how to use the 'onsingletaplistener' but  I couldnt find any function that  detects whether the touch was over the graphics. Can some one help me out?

Basically I am looking for a convenience function to detect whether the touch occurred over a graphic(with PictureMarkerSymbol).
Thanks in Advance

Tom
0 Kudos
3 Replies
deleted-user-ATjHIWsdQYmT
Deactivated User
Check out the IdentifyTask.  That'll get you what you need:
http://resources.arcgis.com/en/help/android-sdk/concepts/index.html#/Identify_task_sample/0119000000...

You'll have to modify your SingleTapListener() event to execute the identify task against the layer you define in your map service (your pins).  If you don't want to modify the SingleTapListener(), you could alternatively use OnLongPressListener().

Hope this helps.
0 Kudos
ThomasBinu
Deactivated User
Check out the IdentifyTask.  That'll get you what you need:
http://resources.arcgis.com/en/help/android-sdk/concepts/index.html#/Identify_task_sample/0119000000...

You'll have to modify your SingleTapListener() event to execute the identify task against the layer you define in your map service (your pins).  If you don't want to modify the SingleTapListener(), you could alternatively use OnLongPressListener().

Hope this helps.


Thank you  for the reply.I ended up the using  graphicsLayer.getGraphicIDs(x, y, tolerance, noOfPointsToBeDetected); to retrieve the graphics ids of the graphics(pins) near the point of touch in an int array  inside singletaplistener().
0 Kudos
deleted-user-ATjHIWsdQYmT
Deactivated User
Ah, I didn't realize (or missed) that you are using a Graphics Layer.  When you said "graphics" I was thinking symbology.  Knowing we're talking about a graphics layer; your implementation seems to be the most feasible.
0 Kudos