android - Mapbox - Confused about the MapboxMap vs MapView -


i using mapbox version 5.1.3 in android app, inside fragment.

following tutorial, on oncreateview method inside relevant fragment, have connected xml resource of mapview instructed, , used getmapasync mapboxmap object.

now, i'm trying use different methods work on map, such .setmylocationenabled, , more. however, of methods methods of mapboxmap class, created inside getmapasync method.

does mean of methods, including polygon creation, connecting buttons map , more, should inside getmapasync method? feels somehow weird.

what confuses me farther, in of tutorials , answers, methods activated on variable named mapview.

this code snippet, hope question clear:

public class mapfragment extends fragment {      private static final string log_tag = "map fragment navigation";      private context appcontext;     private mapview mapview;       @nullable     @override     public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) {         view rootview = inflater.inflate(r.layout.map, container, false);          mapview = (mapview) rootview.findviewbyid(r.id.map);         mapview.oncreate(savedinstancestate);         mapview.getmapasync(new onmapreadycallback() {             @override             public void onmapready(mapboxmap mapboxmap) {                 // set map style                 mapboxmap.setstyleurl(style.mapbox_streets);                   // set camera's starting position                 cameraposition cameraposition = new cameraposition.builder()                         .target(new latlng(41.885, -87.679)) // set camera's center position                         .zoom(12)  // set camera's zoom level                         .tilt(0)  // set camera's tilt                         .build();                  // move camera position                 mapboxmap.movecamera(cameraupdatefactory.newcameraposition(cameraposition));                  // set user location                 mapboxmap.setmylocationenabled(true);                ******* of methods relevant map should go here? including polygon creation, location handlers , more? **************              }         });           return rootview;     } 

(i didn't include other methods such onresume() etc.)


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -