Updating textBox value when browser event is fired from javascript

66 views
Skip to first unread message

Mario Barón

unread,
Mar 18, 2014, 11:36:44 AM3/18/14
to codenameone...@googlegroups.com
Hey guys,

I have a question, I'm using the javascript approach for GoogleMaps and I'm wondering if there's a way to change the value of a textbox or execute a previously written method from a drag event binded to the map or a marker?


Thanks

Shai Almog

unread,
Mar 18, 2014, 3:57:19 PM3/18/14
to codenameone...@googlegroups.com

Mario Barón

unread,
Mar 19, 2014, 3:30:57 PM3/19/14
to codenameone...@googlegroups.com
Hey Shai,


thanks for your response. I've been trying it out a little today, but I have a question about this. I need to be able to obtain the latitude and longitude from a fixed marker on the center of the map. I need this data to be able to Geocode the info into a valid address using the Google APIs for this. 

With this new native map component, would I be able to listen to a drag event done to the map so I can constantly update and save the coordinates of the marker sitting on the center of it? Can you please indicate me how I would do this? 


Thanks. 

Steve Hannah

unread,
Mar 20, 2014, 1:20:14 AM3/20/14
to codenameone...@googlegroups.com

You can do this with the JavaScript bridge.  Just register a java callback function then call it from JavaScript.

See the "calling java methods from JavaScript" section on this page:

https://codenameone.googlecode.com/svn/trunk/CodenameOne/javadoc/com/codename1/javascript/package-summary.html

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/e8779980-5ac6-45ae-8fa2-50dc1355e61e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shai Almog

unread,
Mar 20, 2014, 3:28:28 AM3/20/14
to codenameone...@googlegroups.com
Hi,
yes there is a map listener API as part of the native component: addMapListener(MapListener)
public interface MapListener {

    public void mapPositionUpdated(Component cmpnt, int i, Coord coord);
}

Reply all
Reply to author
Forward
0 new messages