SharedPreferences mSetting = getSharedPreferences("myprefsfile", 0);
//set longitude, latidude on preferences
Di seguito il metodo per il recupero dell'indirizzo:
private String getGoogleMapLocationAddresses()
{
String add = "";
Geocoder gc = new Geocoder(getBaseContext(), Locale.getDefault());
try
{
List<address>
addresses = gc.getFromLocation(Double.parseDouble(mSetting.getString(C_LATITUDE, "")),
Double.parseDouble(mSetting.getString(C_LONGITUDE, "")), 5);
if (addresses.size() > 0)
{
for (int i=0; i<addresses.get(0).getMaxAddressLineIndex(); i++)
add += addresses.get(0).getAddressLine(i) + NL;
}
} catch (IOException e)
{
Log.e(C_TAG, "getGoogleMapLocationAddresses", e);
}
return add;
}
Nessun commento:
Posta un commento