java - Codename One Map -
i want display map coordinates, can on 1 gui element, when duplicate code other gui element map doesn't appear
this code 1 gui element (page or screen)
@override protected void beforemapagps(form f) {     mapcomponent mapcomponent= new mapcomponent();     double latitude=-41.169782;     double longitude =-71.444885;      coord lastlocation = new coord(latitude, longitude);     mapcomponent.zoomto(lastlocation, 15);       f.setlayout(new flowlayout());     f.addcomponent(mapcomponent);     f.show(); } and other gui element (other page or screen) copied first
@override protected void oncreategui1() {  mapcomponent mapcomponent= new mapcomponent();     double latitude=-41.169782;     double longitude =-71.444885;      coord lastlocation = new coord(latitude, longitude);     mapcomponent.zoomto(lastlocation, 15);       f.setlayout(new flowlayout());     f.addcomponent(mapcomponent);     f.show(); } when run simulator map appear on first page or screen, , not on other
message received when save designer
firstly, don't use flowlayout peer component or complex components map, browser, list, multi-list...
secondly, implementing map code in oncreate method second form. inside beforeshow() or postshow() methods.
and lastly, requesting form that's showing show again calling f.show() inside beforeshow() method. 
change code to:
@override protected void beforemapagps(form f) {     mapcomponent mapcomponent= new mapcomponent();     double latitude=-41.169782;     double longitude =-71.444885;      coord lastlocation = new coord(latitude, longitude);     mapcomponent.zoomto(lastlocation, 15);      f.setlayout(new borderlayout());     f.addcomponent(borderlayout.center, mapcomponent); } and second 1 to:
@override protected void beforegui1(form f) {     mapcomponent mapcomponent= new mapcomponent();     double latitude=-41.169782;     double longitude =-71.444885;      coord lastlocation = new coord(latitude, longitude);     mapcomponent.zoomto(lastlocation, 15);      f.setlayout(new borderlayout());     f.addcomponent(borderlayout.center, mapcomponent); } 
Comments
Post a Comment