我正在Android的GoogleMap上工作。“如何从LatLong获取实际的文本值(地名)?”
到目前为止,我已经获得了当前位置并在其上显示了标记。
我从当前位置获得LatLong值。
我可以使用下面的代码获取城市名称:
Geocoder gcd = new Geocoder(MainActivity.this, Locale.getDefault());
List<Address> addresses = null;
try {
addresses = gcd.getFromLocation(mLocation.getLatitude(), mLocation.getLongitude(), 1);
} catch (IOException e) {
e.printStackTrace();
}
if (addresses.size() > 0)
System.out.println(addresses.get(0).getLocality());
Toast.makeText(MainActivity.this,""+addresses.get(0).getLocality(),Toast.LENGTH_LONG).show();
}
但是,不能得到atual区域名称即Bodakdev字符拉斯塔,艾哈迈达巴德。
现在,我的问题是:如何从LatLong获取实际文本值(地点名称)?
雅我可以用上面的代码的城市名称,但如果我想要做如上的修改建议是什么? –
请参阅我编辑的答案。这会给你所有的细节。如果信息不适用于该输入集,则为NULL。 @JaiminModi –