title: How to get current location in android google maps api V2?
body: <p>I am trying to get the current location in android google maps v2. This is my code:</p>
  
  <pre><code>package android.arin;
  
  import java.util.List;
  import location.Location;
  import com.google.android.gms.common.ConnectionResult;
  import com.google.android.gms.common.GooglePlayServicesClient;
  import com.google.android.gms.location.LocationClient;
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.SupportMapFragment;
  import com.google.android.gms.maps.model.LatLng;
  import com.google.android.gms.maps.model.MarkerOptions;
  import fish.Species;
  import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.view.Menu;
  import android.view.MenuItem;
  
  public class MapScreen extends FragmentActivity implements GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener {
  
      private Species selectedfish = null;
      private GoogleMap map = null;
      private LocationClient locationClient = null;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_map_screen);
  
          setUpScreen();
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.map_screen, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
          switch (id) {
  
          }
          return super.onOptionsItemSelected(item);
      }
  
      private void setUpScreen() {
          selectedfish = (Species) NavigationScreen.FishWhosOptionsClicked;   
          map = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
          map.setMyLocationEnabled(true);
  
  
          List&lt;Location&gt; locations = selectedfish.getLocations();
          for(int i=0; i&lt;locations.size(); i+=1) {
              Location location = locations.get(i);
              LatLng latlong = new LatLng(location.getLatitude(), location.getLongitude());
  
              map.addMarker(new MarkerOptions()
              .title(location.getAddress())
              .snippet(location.getComment())
              .position(latlong));
          }
  
          locationClient = new LocationClient(this, this, this);
      }
  
      @Override
      public void onConnectionFailed(ConnectionResult result) {
          // TODO Auto-generated method stub
  
      }
  
      @Override
      public void onConnected(Bundle connectionHint) {
          android.location.Location location = locationClient.getLastLocation();
  
          LatLng latlong = new LatLng(location.getLatitude(), location.getLongitude());
          map.moveCamera(CameraUpdateFactory.newLatLngZoom(latlong, 10));
      }
  
      @Override
      public void onDisconnected() {
          // TODO Auto-generated method stub
  
      }
  }
  </code></pre>
  
  <p>But it doesn't seem to work. It doesn't crash, but it doesn't move to where I am...</p>
  
  <p>Does anyone know how to fix this?</p>
  
  <p>Thanks.</p>