简体   繁体   中英

How do I get the blue location dot to appear in my Android application?

I'm fairly new to Android programming and I'm a bit stuck. I have a map set up and now I want to add the blue flashing dot to the application to show where the user is on the map.

How do I do this?

Just try implementing this code, hope this works fine for you.

 private GoogleMap mMap;

    mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();

    mMap.addMarker(new MarkerOptions()
        .position(new LatLng(0, 0))
        .title("Hello world")
    .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));

If it does not work for you, try keep in touch with me.

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