Code example for Geocoder

Methods: getFromLocation

0
        mContext = context;
    } 
 
    @Override 
    protected Address doInBackground( Location... params ) {
        Geocoder geocoder = new Geocoder( mContext, Locale.getDefault() );
 
        Location location = params[0];
 
        List<Address> addresses = null;
 
        try { 
            addresses = geocoder.getFromLocation( location.getLatitude(), location.getLongitude(), 1 );
        } catch ( IOException e ) {
            Logger.error( e.toString() );
        } catch ( IllegalArgumentException e ) {
            Logger.error( e.toString() );
        } 
 
        if ( addresses != null && addresses.size() > 0 ) {
Stop searching for code, let great code find you!  Add Codota to your java IDE