title: How can we get current location as default location in Android google map?
body: <p>In my application i have implemented google map using geocode and autocomplete. I have done in 'Fragment' and the app was a successfully. Now i wanted to display my current location as a default location in my map. Also it should be displayed if i go out from that page and come back.
  In my autocomplete text i can search places and it is displayed successfully. All i want is to set my current location as default when i am not searching anything.</p>
  
  <p>i tried adding the following in 'OnResume()'</p>
  
  <pre><code>theMap.setMyLocationEnabled(true);
  </code></pre>
  
  <p>This helped me to mark my current location, but i am not able to zoom and see my place as by default it displays 'Africa'. even thou my current location is marked.</p>
  
  <p>then i called the following function in 'OnResume'</p>
  
  <pre><code>public void getMyLocation()
          {
  
              theMap.setOnMyLocationChangeListener(new OnMyLocationChangeListener() {
  
              @Override
              public void onMyLocationChange(Location location) {
                  // TODO Auto-generated method stub
                  Log.v("current location lat:", ""+location.getLatitude());
                  Log.v("current location lng:", ""+location.getLongitude());                 
                  theMap.animateCamera(CameraUpdateFactory.newLatLng(new LatLng(location.getLatitude(), location.getLongitude())));
                  CameraUpdate center=
                          CameraUpdateFactory.newLatLngZoom(new LatLng(location.getLatitude(), location.getLongitude()),16);
                      CameraUpdate zoom=CameraUpdateFactory.zoomTo(12);
  
                      theMap.moveCamera(center);
                      theMap.animateCamera(zoom);
              }
          });
          }
  </code></pre>
  
  <p>After this my current location is displayed continuously after a fraction of seconds. I tried to search a place. But the place is displayed only for 2-3 seconds and again it moved to my current location. I don't know how to solve.</p>