2
如何獲得iso3國家code.when我存儲服務器,但它不存儲100%的數據庫?我使用這些code.Please幫我感謝,並提前...得到iso3國家代碼
geocoder = new Geocoder(this);
locationManager = (LocationManager)getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
bestProvider =locationManager.getBestProvider(criteria,false);
location = locationManager.getLastKnownLocation(bestProvider);
if(location!=null)
{
lat=location.getLatitude();
lng=location.getLongitude();
}
else
{
location = new Location("");
location.setLatitude((double)38.0000000000);
location.setLongitude((double)-97.0000000000);
lat =location.getLatitude();
lng=location.getLongitude();
}
Log.e("","Latitude and Longitude"+"Latitude="+lat+"Longitude="+lng);
try
{
addresses=geocoder.getFromLocation(lat,lng, 1);
}
catch (IOException e)
{
e.printStackTrace();
}
if (addresses != null && addresses.size() > 0)
{
Address address = addresses.get(0);
Log.e("Address=",""+address);
locale = address.getCountryCode();
Log.e("Locale",""+locale);
Toast.makeText(SongsList.this, "LocaleName"+locale,Toast.LENGTH_LONG).show();
}
可能重複[獲取ISO國家代碼(http://stackoverflow.com/questions/9529285/get -the異國家代碼) – 2012-03-02 07:54:40