How do I allow user to select area on Google Map in Android? with example -


here code adding marker , circle

i want provide functionality user can increase radius of circle accordingly, have given bar, when user increases bar radius of circle increase , vice versa.

    googlemap.setonmapclicklistener(new onmapclicklistener() {            @override         public void onmapclick(final latlng point) {                // drawing marker on map 

/*

*/

         // creating marker             markeroptions markeroptions = new markeroptions();              // setting position marker             markeroptions.position(point);              // setting title marker.             // displayed on taping marker             markeroptions.title(point.latitude + " : " + point.longitude);              // clears touched position             googlemap.clear();              // animating touched position             googlemap.animatecamera(cameraupdatefactory.newlatlng(point));                seekbar.setonseekbarchangelistener(new onseekbarchangelistener() {                 int r=100;                  @override                 public void onstoptrackingtouch(seekbar seekbar) {                     // todo auto-generated method stub                  }                  @override                 public void onstarttrackingtouch(seekbar seekbar) {                     // todo auto-generated method stub                  }                  @override                 public void onprogresschanged(seekbar seekbar, int progress,                         boolean fromuser) {                     // todo auto-generated method stub                              googlemap.addcircle(new circleoptions()                             .center(new latlng(point.latitude,point.longitude))                             .radius(r)                                     .strokecolor(color.blue)//border color                             .strokewidth(3.0f)//border width                             .fillcolor(0x200000ff)                             );                    }               });              // placing marker on touched position             googlemap.addmarker(markeroptions);               toast.maketext(getbasecontext(), "your choice added ", toast.length_short).show();          }     });   });   } 

}

the solution problem involve combination of map overlays canvas. once seekbar listener detect change can instruct map overlays increase or decrease size of circle. change in radius function of canvas. code implementation please refer stack overflow solution.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -