I have a geocoder, gcd, and this line of code that reverse-geocodes
List<Address> addresses = gcd.getFromLocation(latitude, longitude, 1);
if(addresses != null) {
Address returnedAddress = addresses.get(0);
for(int i=0; i<returnedAddress.getMaxAddressLineIndex(); i++) {
strReturnedAddress = (returnedAddress.getAddressLine(i)).toString();
strReturnedAddress returns something like
10453 Central Bronx, New York City, NY
I only need the city name, which is New York City.
Removing parts of the string would be extremely hard since the output of the geocode can change. I just need the geocode to give me the city.
I have checked http://developer.android.com/reference/android/location/Geocoder.html but could not find an answer.