简体   繁体   中英

android google map markers dont shown

My application heve 3 tabs, one of tabs contain google map. When I start my application, I see map, I can zoom and move on map, but I don't see crated markers on it.

Maps activity have auto generated code:

public void onMapReady(GoogleMap googleMap) {
        mMap = googleMap;

        // Add a marker in Sydney and move the camera
        LatLng sydney = new LatLng(-34, 151);
        mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
        mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
    }

Check if you have enabled maps for android in Google API Console . Check if you have followed all the steps mentioned in the Official Google Documentation . Your activity must extend FragmentActivity and to initialize GoogleMap object. Make sure you have added support library.

Try to create a map with this line:

MapFragment mMapFragment=MapFragment.newInstance(mapOptions());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM