Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: GoogleMap v2 ignores animate/move calls
    primarykey
    data
    text
    <p>I have a FragmentActivity with a GoogleMap inside. It correctly receives the user location in onLocationChanged, where I try to use the user location to center the map:</p> <pre><code>@Override public void onLocationChanged(Location loc) { if (centerMap &amp;&amp; mMap != null) { LatLng location = new LatLng(loc.getLatitude(), loc.getLongitude()); CameraPosition pos = new CameraPosition.Builder().target(location).zoom(12).build(); CameraUpdate cu = CameraUpdateFactory.newCameraPosition(pos); mMap.animateCamera(cu); // centerMap = false; Log.e(getClass().getSimpleName(), "lat = " + location.latitude + " long = " + location.longitude); } } </code></pre> <p>This code actually worked now and then (maybe only once), and only during a debug session where I put a breakpoint inside the if statement. I don't understand what's wrong. The onLocationChanged method gets called regularly, it logs the position it received, that implies it entered the if condition, but the map does not move an inch from the lat=0,long=0 initial position (Africa).</p> <p>Any clues?</p> <p>EDIT: I must have something badly broken in my code: even markers do not show up, here is how I add them to the map</p> <pre><code>mMap.addMarker(new MarkerOptions() .position(new LatLng(lat, lng)) .title("title") .draggable(false) .visible(true)); </code></pre> <p>and the "My location" icon is not showing up either, even if I called</p> <pre><code>mMap.setMyLocationEnabled(true); </code></pre> <p>in onCreate(). Trying to exclude martians and such, I've already updated Eclipse, ADT and all the rest to the latest available versions.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload