On Mon, Jul 6, 2009 at 8:44 PM, Piotr
Kirklewski<[email protected]> wrote:
>
> Hi there
> It's about maps and markers.
> So I have a table with some location (restaurants) and their coordinates.
> I'm adding marker to the map like this:
>
> MarkerOptions mo = MarkerOptions.newInstance();
> mo.setClickable(true);
> mo.setTitle(result[j][1] + ", " +
> result[j][0]);
> Float lt = new
> Float(result[j][2].toString());
> Float ln = new
> Float(result[j][3].toString());
Make these 'double' not 'Float'. The former are primitive types, the
latter are objects.
> Marker newmarker = new
> Marker(LatLng.newInstance(lt, ln), mo);
> mapWidget.addOverlay(newmarker);
> newmarker.addMarkerClickHandler(new
> MarkerClickHandler() {
>
>
> So I have a click handler on all of those guys but when clicked I need
> somehow distinguish between them.
> I think that getting the coordinates of clicked marker would be a good
> Idea as it's unique so I can query database an produce report for that
> particular location.
> But I have no idea how to start.
>
> When I try this:
> newmarker.getLatLng();
>
> I get following error:
> Cannot refer to a non-final variable newmarker inside an inner class
> defined in a different method
>
> Anyone knows how to do that ?
Add 'final' in front of the parameter named 'newmarker' in your
method. I hope that's enough to get you started.
-Eric.
--
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" 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/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---