This was created with guidance from Kaj (below)
Figured my problem out, but this may be useful for someone else looking to jump to current users location:
boolean touched = false;
if(touched == false){
mapController.animateTo(point);
}
myLocationBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
touched = false;
}
});
@Override
public bool开发者_开发知识库ean onTouchEvent(MotionEvent event, MapView mapView)
{
//---when user lifts his finger---
if (event.getAction() == 1) {
touched = true;
}
return false;
}
Your onClick
should say touched = "no";
and not String touched = "no";
. Btw, it's probably better to change it to a boolean, so that you have true/false
, instead of having strings.
You should normally not compare strings with ==
, use string.equals(anotherString)
instead.
精彩评论