i have one small problem.Basically what i want to do is draw waypoint to map ,with touches.But i want to stop that onTouch method after one waypoint added,cause now it add more waypoints with one click ,and continue add them with next touches.
Heres the method
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if(resultCode==RESULT_OK)
{
final MapPoint point=(MapPoint) data.getSerializableExtra("result");
GeoPoint point2 = new GeoPoint(51496994, -134254);
point.setGeo(point2);
view.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent e) {
GeoPoint geo = null;
IProjection project = view.getProjection();
geo=(GeoPoint)project.fromPixels((int)e.getX(),(int)e.getY());
mainDrawer.addGeopointToMap(point.getName(), point.getDesc(), geo);
return false;
}});
}
you can simply set the actionListener to null this will make the action to called at the first time, then it will be null so it will not called again.
view.setOnTouchListener(new View.OnTouchListener()
{
@Override
public boolean onTouch(View v, MotionEvent e) {
GeoPoint geo = null;
IProjection project = view.getProjection();
geo=(GeoPoint)project.fromPixels((int)e.getX(),(int)e.getY());
mainDrawer.addGeopointToMap(point.getName(), point.getDesc(), geo);
view.setOnTouchListener(null)
return false;
}});
}