log Address - Android Map

Android examples for Map:Address

Description

log Address

Demo Code


//package com.java2s;
import android.location.Address;
import android.util.Log;

public class Main {
    public static void logAddress(String logTag, Address address) {

        int maxAddressLineIndex = address.getMaxAddressLineIndex();
        for (int i = 0; i <= maxAddressLineIndex; i++) {
            String addressLine = address.getAddressLine(i);
            Log.d(logTag, i + ":  " + addressLine);
        }//from w ww.  jav  a  2 s.  c o  m

        double latitude = 0.0d;
        double longitude = 0.0d;

        boolean hasLatitude = address.hasLatitude();
        if (hasLatitude) {
            latitude = address.getLatitude();
        }
        boolean hasLongitude = address.hasLongitude();
        if (hasLongitude) {
            longitude = address.getLongitude();
        }

        String adminArea = address.getAdminArea();
        String featureName = address.getFeatureName();
        String locality = address.getLocality();
        String postalCode = address.getPostalCode();
        String premises = address.getPremises();
        String subAdminArea = address.getSubAdminArea();
        String subLocality = address.getSubLocality();
        String subThoroughfare = address.getSubThoroughfare();
        String thoroughfare = address.getThoroughfare();
        String phone = address.getPhone();
        String url = address.getUrl();

       
    }
}

Related Tutorials