大家好,今天从两个版本(arcgis for android beta和arcgis for android2.0)写一下arcgis for android的点击GraphicsLayer如何找到已经添加到GraphicsLayer上面对应的Graphic,从而显示出对应Graphic的信息内容,
本人从arcgis for android beta开始学习使用到arcgis for android2.0,经过了1.0,1.1,..等等,目前使用2.0开发,相对来说2.0是比较稳定的,相对比较,两个版本过渡时期去掉了许多功能,新版本相对更加稳定,功能更强大,废话不多说,上代码:
public OnTouchListener onClick() {
return new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
float x = (float) event.getX();
float y = (float) event.getY();
Graphic[] gs = photoPointGraphicsLayer.getGraphics(x, y, 20);
int count = gs.length;
if (count > 0) {
picAbsolutePath = "";
Point p = null;
try {
picAbsolutePath = gs[0].getAttributeValue("PATH").toString();
p = (Point) gs[0].getAttributeValue("POINT");