In that case, what I would probably do is derive a class from
MyLocationOverlay, as you already mentioned, and override the onTap function
(not dispatchTap). I believe this is called whenever the map view is pressed
anywhere, but then only returns true if the given overlay was actually
tapped (to prevent dispatching the event to the other overlays).

So simply:
public boolean onTap(GeoPoint gp, MapView mv)
{
 // Do what you need with current accuracy and location

 return super.onTap(gp, mv);
}

Hope that helps.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking


On Fri, Dec 11, 2009 at 8:19 AM, Chris
<[email protected]>wrote:

> Essentially I want to get the current location, the idea of the click
> on the map is for the user to indicate they are happy with the current
> location and accuracy.  They might well be driving at the time so
> ideally the bigger the area to press the better so not as to distract
> them to much by having to focus on a small button.
>
> The only alternative I can think of is a send when accuracy is better
> than x but then you have to set a reasonable resolution and what if
> this is never hit for whatever reason?  Also moving forward the user
> might be able to move the icon (if i replace the overlay anyway) to
> make it more accurate.
>
> Chris.
>
> On Dec 10, 7:26 pm, TreKing <[email protected]> wrote:
> > I don't know for sure, but i wouldn't be surprised if the maps activity
> and
> > / or view doesn't actually handle directly clicking the view.
> >
> > What are you actually trying to do when touching the screen at any given
> > point? There's probably an easy way to accomplish what you want to do
> with
> > overlays.
> >
> >
> ---------------------------------------------------------------------------
> ----------------------
> > TreKing - Chicago transit tracking app for Android-powered deviceshttp://
> sites.google.com/site/rezmobileapps/treking
> >
> > On Thu, Dec 10, 2009 at 8:28 AM, Chris
> > <[email protected]>wrote:
> >
> >
> >
> > > Hi I am working on my first android app and so my first with the Maps
> > > API and am experiencing an odd problem.
> >
> > > I have a mapview with the property clickable set to true:
> > > <com.google.android.maps.MapView
> > >        android:id="@+id/mapview"
> > >        android:layout_width="fill_parent"
> > >        android:layout_height="fill_parent"
> > >        android:clickable="true"
> > >        android:apiKey="MY_DEBUG_KEY"
> > >    />
> >
> > > I have registered for the click event:
> > >            mapView = (MapView) findViewById(R.id.mapview);
> > >            mapView.setBuiltInZoomControls(true);
> >
> > >            mapView.setOnClickListener(new OnClickListener() {
> >
> > >                        @Override
> > >                        public void onClick(View v) {
> > >                                // onClick Code.
> > >                        }
> > >                });
> >
> > > How ever when I click the screen it seems the onClick event is not
> > > being run?  Have I missed something or am I better off sub classing
> > > the MyLocationOverlay I am using and override DispatchTap()?  How ever
> > > i would rather be able to just click anywhere on the map to dispatch
> > > the event.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to
> [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<android-developers%[email protected]><android-developers%2Bunsubs
> [email protected]>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en

Reply via email to