0
 Place selectedPlace = PlacePicker.getPlace(data, this);
 selectedPlace.getAddress()


How to get city,state,country,pin code, name from android google location picker result?
Currently getaddress method contain every thing as single string and it is not an array to get city with index.
How to programmily separate it?

Midhilaj
  • 4,905
  • 9
  • 45
  • 88

1 Answers1

0

The way the Place object is build baffles me. I'm struggling with that one as well.

The answer to you're question anyway is fairly simple as you can just split the given String at every "," with the following:

String[] stringArray = place.getAddress().toString().split(",");

Sadly, you still don't know what place of the array the country is in, as this may vary depending the selected location.

Here they talk about the possibilities of getting each separate value for the selected location by using a reverse lookup or parsing the address through a service.

I also found a library that looks very promising and looks to be based on or extended from the original from google.

ChristianoBolla
  • 538
  • 1
  • 5
  • 20