android - Google map camera position on multiple markers -


After

I am using Google Map API2 and show several markers on it. My problem is that I want my camera to be located on all my markers. I have done this as a marker for

  myMap.moveCamera (CameraUpdateFactory.newLatLngZoom (MyLocation, 22));    

The way I used below to see all in keeping with markers. This will bound your legacy with all the loud-long locations in your array list. See

  // can not zoom to the pan // range to see all the markers unless the size of the map is there. Last View MapView = getSupportFragmentManager () findFragmentById (R.id.map) .getView () .; If (mapView.getViewTreeObserver () .isAlive ()) {mapView.getViewTreeObserver (). AddOnGlobalLayoutListener (new on Globlloalaijhr () {@SuppressLint ( "NewApi") public void (override @GlobalLayout) {lots Laँgbolskbilder Bieldi = new lots long Bounds. Manufacturer (); (i = 0 int i; I & LT; YOUR_ARRAYLIST.size (); i ++). {LatLng ll = new LatLng (YOUR_ARRAYLIST.get (i) .getPos () getLat (), YOUR_ARRAYLIST.get (i).. getPos () getLon ()); bld.include (LL);} LatLngBounds border = bld.build (); mMap.moveCamera (CameraUpdateFactory.newLatLngBounds (range, 70)) ;. mapView.getViewTreeObserver () removeGlobalOnLayoutListener (this);}}); }   

Hope this will help.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -