Hi,
I'm not sure if this is the right place to post this, but I've run
into a wall on this. I'm writing an app that has certain locations
stored on the phone, and displays the locations on points drawn by an
Overlay on a Map. What I want to do is write it so that when the
person clicks on the point, a dialog shows up containing information
about that point. I've successfully used the OnTouchListener to do
this. However, the problem arises when I want to move the Map. Once I
click elsewhere on the map, it seems like the OnTouchListener just
dies and goes away so that every subsequent time I click on a point,
it will not show a Dialog. The OnTouchListener uses the Overlay's
onTouchEvent to see if the point is clicked. The Overlay recognizes
that the point is being clicked, but I cannot launch a Dialog from the
Overlay, which is the problem.

Thanks,
Andrew

Here is the code:
----------------------------------------------------------------------------------------------
        OnTouchListener OTL = new OnTouchListener(){
                @Override
                public boolean onTouch(View v, MotionEvent event){
                        if(mapOverlay.onTouchEvent(event, mapView)){
                                showDialog(DIALOG_ID);
                                mapView.invalidate();
                                return true;
                        }
                        return false;
                }
        };

        @Override
        protected void onCreate(Bundle savedInstanceState){
                super.onCreate(savedInstanceState);
                setContentView(R.layout.map);
                adapter = new Adapter(this);
                adapter.open();

                mapView = (MapView) findViewById(R.id.mapview);
                mapView.setSatellite(true);
                mapView.setStreetView(true);
                mapView.setBuiltInZoomControls(true);

                c = adapter.getAll();
                startManagingCursor(c);

                mapController = mapView.getController();

                mapOverlay = new MapOverlay(c);
                mapView.getOverlays().add(mapOverlay);

                mapView.setOnTouchListener(OTL);
                mapView.postInvalidate();

        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to