is there any way to get city name for Google Place picker android

Viewed 3505

I am trying to get city name from Google place picker. is there any way that we can get city name using place picker API. i know we can not simply get it from API by placing place.getCity(); Below is my code.

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

        if(requestCode == REQUEST_PLACE_PICKER){

            if(resultCode==RESULT_OK){

                Place place = PlacePicker.getPlace(data,this);

                final CharSequence name = place.getName();
                final CharSequence address = place.getAddress();
                final CharSequence phone = place.getPhoneNumber();
                final String placeId = place.getId();
                final LatLng latLng = place.getLatLng();

                if(place.getLocale() != null) {
                    String aname = place.getLocale().toString();
                    areaname.setText(aname);
                }

                location.setText(address);
                gname.setText(name);
                latlon.setText(String.valueOf(latLng));

            }
        }
    }

I don't want any null values in city. i read Geocoder will give mostly null values.

1 Answers
Related