我希望在 android 中实现反向地理编码,但我遇到了一些问题,有人能给我一些指导吗?这是我的代码:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textLong = (TextView) findViewById(R.id.textLong);
textLat = (TextView) findViewById(R.id.textLat);
LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
LocationListener listener = new myLocationListner();
manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, listener);
}
public class myLocationListner implements LocationListener{
@Override
public void onLocationChanged(Location location) {
if (location != null){
double gettextLong = location.getLongitude();
double gettextLat = location.getLatitude();
textLat.setText(Double.toString(gettextLat));
textLong.setText(Double.toString(gettextLong));
}