Dec 3, 2009
Bath, OH, USA
Hello everyone! Hopefully I can get some help here; the google group does not seem very helpful. I'm a beginner to the Android SDK as well as java for that fact (VB.NET background).

I have a map with some geometry drawn on it by overriding the onDraw event. I'm trying to detect when the user touches on of the shapes and attempting this with the following code

public class Map extends MapActivity implements OnTouchListener {

    public MapView _mvMap;
    private Geo.Geometry _oGeo;

    public void onCreate(Bundle savedInstanceState) {

        _mvMap = (MapView) findViewById(;
        _oGeo = new Geo().new Geometry(_mvMap);


    public boolean onTouch(View v, MotionEvent event) {
        int Action = event.getAction();
        Geo.Geometry Geo = _oGeo.SetTouched((int)event.getX(), (int)event.getY());
        switch (Action) {
            case MotionEvent.ACTION_UP:
                if (Geo != null) {
                    //Do Some Processing
        if (Geo != null) return true;
        return true;
Ok so when the screen is touched, it will pass the coordinates into the Geo class and look for an object that contains those coordinates. If the touch was within the object, then I will do some processing and return true so the event is not passed down the the map. If the touch is not in the object then the event is passed down to the map as normal so the user can scroll and such.

If they touch an object everything is fine, they can keep touching more and I keep getting the event. The problem is when its not on an object. I'll get the first ACTION_DOWN, ACTION_MOVE, and ACTION_UP but no more events after that hit the onTouch handler.

What am I doing wrong?
It was an amazing article! A writer like you should be given credit for your dedication to work as your provide good quality articles with the good purpose. I like to read such articles for they tackle different issues in our society as well as different practicalities and knowledge that a certain person should or must know. I will keep reading your next post that will be an interesting article again as usual.