Unable to see multiple marker on google Map

后端 未结 3 1882
灰色年华
灰色年华 2021-01-21 04:53

I want to show multiple markers on a google map. My latlng coordinates are fetched from a Parse database but I am not able see marker. My second problem is that I

3条回答
  •  生来不讨喜
    2021-01-21 05:46

    Try this

    //  Create lat long points
    Latlng[] point_new = new LatLng[8];
                    point_new[0] = new LatLng(31.5301843, 74.3207487);
                    point_new[1] = new LatLng(31.5214693,74.3236027);
                    point_new[2] = new LatLng(31.5194393, 74.3257327);
                    point_new[3] = new LatLng(31.4942166, 74.3004533);
                    point_new[4] = new LatLng(31.4864646, 74.2911203);
                    point_new[5] = new LatLng(31.4803596, 74.2787933);
                    point_new[6] = new LatLng(31.4764716, 74.2638203);
                    point_new[7] = new LatLng(31.4775236, 74.2628873);
    //  Add markers 
    
     for (int i = 0; i < point_new.length; i++) {
                        MarkerOptions markerOptions = new MarkerOptions()
                                .position(point_new[i]);
                        marker = mMap.addMarker(markerOptions);
                        marker.setTitle("Points");
                        marker.setSnippet("Distance = 9.6 km, Time = 20 minute/s");
                        marker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.p));
    }
    

    // Set camera to last point with Zoom level 9

    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(point_new[7], 9));
    

提交回复
热议问题