Thanks Mike for your quick reply, I have tested with new API version
(2.184) but the error is still there. I cannot post the url of the
page as client don't want this. What I have done on the button is
pasted below.



CustomControl saveHomeControl = new CustomControl(new ControlPosition(
                                ControlAnchor.BOTTOM_LEFT, 2, 2)) {

                        @Override
                        public boolean isSelectable() {
                                return true;
                        }

                        @Override
                        protected Widget initialize(final MapWidget map) {
                                saveHomeButton = new Button("Save center of map 
as my home");
                                
saveHomeButton.addListener(buttonListenerAdapter);
                                return saveHomeButton;
                        }
                };

buttonListenerAdapter = new ButtonListenerAdapter() {

                        @Override
                        public void onClick(Button button, EventObject e) {
                                LatLng latlang = map.getCenter();
                                saveUserHome(latlang.getLatitude(), 
latlang.getLongitude());
                        }

                };


private void saveUserHome(double latitude, double langitude) {

                ApplicationContext applicationContext = ApplicationContext
                                .getApplicationContext();
                User currentUser = applicationContext.getCurrentUser();
                if (currentUser != null) {
                        UserServiceAsync userService = 
GWT.create(UserService.class);
                        currentUser.setHomeLatitude(latitude);
                        currentUser.setHomeLongitude(langitude);
                        map.removeOverlay(homeMarker);
                        homeMarker = addMarker(0, currentUser.getHomeLatitude(),
                                        currentUser.getHomeLongitude(), "My 
home", false);
                        userService.updateUser(currentUser, new 
AsyncCallback<User>() {
                                @Override
                                public void onFailure(Throwable caught) {

                                }

                                @Override
                                public void onSuccess(User result) {

                                }
                        });
                }
        }

--

You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-maps-api?hl=en.


Reply via email to