Check if user clicked on graphic

Discussion created by tmsbn90 on Aug 6, 2013
Latest reply on Aug 6, 2013 by agup-esristaff
Hi guys,

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.

map.setOnSingleTapListenere( new onSingleTapListener(pointX,pointY){

// inflate callout and show
}else if((graphicsLayer2.getGraphicIDs(x,y,tolerance)).length==0){
// inflate callout and show
}else if((graphicsLayer3.getGraphicIDs(x,y,tolerance)).length==0){
// inflate callout and show
}else  if((featurelayer1.getGraphicIDs(x,y,tolerance)).length==0){
// inflate callout and show
}else  if((featurelayer2.getGraphicIDs(x,y,tolerance)).length==0){
// inflate callout and show


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.