I'm using GPS to return the user's address. Everything works fine, however the returned ZIP code is in the American standard, with 5 digits. Does anyone know any library or any way to get the 8-digit Brazilian standard?
public static void getAddressFromLocation(final double latitude, final double longitude, final Context context, final Handler handler)
{
Thread thread = new Thread() {
@Override
public void run() {
Geocoder geocoder = new Geocoder(context, Locale.getDefault());
String result = null;
// String tudo[] = new String[0];
try {
List<Address> addressList = geocoder.getFromLocation(
latitude, longitude, 1);
if (addressList != null && addressList.size() > 0) {
Address address = addressList.get(0);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < address.getMaxAddressLineIndex(); i++) {
sb.append(address.getAddressLine(i)).append("\n");
// tudo[i] = address.getAddressLine(i).concat("\n");
}
sb.append(address.getAdminArea()).append("\n");
sb.append(address.getLocality()).append("\n");
sb.append(address.getPostalCode()).append("\n");
result = sb.toString();
}
}
}
}
}