Example usage for android.location Address getSubThoroughfare

List of usage examples for android.location Address getSubThoroughfare

Introduction

In this page you can find the example usage for android.location Address getSubThoroughfare.

Prototype

public String getSubThoroughfare() 

Source Link

Document

Returns the sub-thoroughfare name of the address, which may be null.

Usage

From source file:es.rczone.tutoriales.gmaps.MainActivity.java

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    /**//from  w  ww  .  j  a  v a  2 s . co m
     * Result for Address activity
     */
    if (requestCode == 1) {

        if (resultCode == RESULT_OK) {
            Address current_location = data.getExtras().getParcelable("result");
            LatLng addressLocation = new LatLng(current_location.getLatitude(),
                    current_location.getLongitude());
            CameraPosition camPos = new CameraPosition.Builder().target(addressLocation) //Center camera in 'Plaza Maestro Villa'
                    .zoom(16) //Set 16 level zoom
                    .build();

            CameraUpdate camUpd3 = CameraUpdateFactory.newCameraPosition(camPos);
            map.animateCamera(camUpd3);
            String description = current_location.getThoroughfare() + " "
                    + current_location.getSubThoroughfare() + ", " + current_location.getLocality() + ", "
                    + current_location.getCountryName();

            Marker m = map.addMarker(new MarkerOptions().position(addressLocation));
            markersList.add(m);

            Toast.makeText(this, description, Toast.LENGTH_LONG).show();
        }
        if (resultCode == RESULT_CANCELED) {
            // Write your code if there's no result
        }
    }
}