android - Get current location as TEXT with Google Maps API v2 -


i retrieving current location in app need text of location, or city in @ least, that.

is there known way can this?

this have far:

package ro.gebs.captoom.activities;  import android.app.activity; import android.location.criteria; import android.location.location; import android.location.locationmanager; import android.os.bundle; import android.view.window;  import com.example.captoom.r; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.mapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.marker; import com.google.android.gms.maps.model.markeroptions;  public class locationactivity extends activity {      private googlemap map;      @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         getwindow().requestfeature(window.feature_action_bar);         getactionbar().hide();         setcontentview(r.layout.preview_location);          map = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.map))                 .getmap();          locationmanager service = (locationmanager) getsystemservice(location_service);         criteria criteria = new criteria();         string provider = service.getbestprovider(criteria, false);         location location = service.getlastknownlocation(provider);         latlng userlocation = new latlng(location.getlatitude(),location.getlongitude());           if (map != null) {             marker current_location_marker = map.addmarker(new markeroptions().position(userlocation)                       .title("current location"));         } else {          }          map.movecamera(                 cameraupdatefactory.newlatlngzoom(userlocation, 10));          // zoom in, animating camera.         map.animatecamera(                 cameraupdatefactory.zoomto(10), 2000, null);      }  } 

first have current latitude , longitude can use google api current address component. see answer on question address lat long

get particular address using latitude , longitude


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -