title: onClick wait 1 second then run code
body: <p>I have this code that by clicking on button the camera centers in my location on map.</p>
  
  <p>The problem is: When I click the first time, the camera goes too far away from my position and I suspect that the onClick method is making the location manager get only partial coordinates ( When I click the same button for the second time it gets the right spot.)</p>
  
  <p>So, here is the code:</p>
  
  <p>What I would like to try was:</p>
  
  <ol>
  <li>I click on the button</li>
  </ol>
  
  <p>2.</p>
  
  <pre><code>   locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE)
     location= locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
     longitude = location.getLongitude();
     latitude = location.getLatitude();
     latlng = new LatLng(latitude, longitude);
  </code></pre>
  
  <p>This code runs</p>
  
  <ol start="3">
  <li>wait 1 second</li>
  </ol>
  
  <p>4.</p>
  
  <pre><code>   CameraUpdate center = CameraUpdateFactory.newLatLng(latlng);
     CameraUpdate zoom = CameraUpdateFactory.zoomTo(15);
     map.moveCamera(center);
     map.animateCamera(zoom);
     map.addMarker(new MarkerOptions()
     .position(latlng));
  </code></pre>
  
  <p>This code runs.</p>
  
  <p>Is this possible?</p>
  
  <p>Sorry the basic question but I'm new to Java/Android programming (3 weeks or so and I still find some basic things like this hard to achieve).</p>
  
  <p>PS: The code is running almost in perfection, the only thing that it's bothering me is that I have to click twice for it to get in the spot that it's supposed to be ( in the first click it gets about 3 to 4 km away from it - estimate calculation)</p>