Android 将DDMS提供的坐标转换为位置

Android 将DDMS提供的坐标转换为位置,android,eclipse,location,ddms,Android,Eclipse,Location,Ddms,我正在创建一项服务,每5分钟更新一次用户位置。我正在使用DDMS将坐标发送到模拟器。我想转换坐标并找到位置。我该怎么做?我是android新手,请帮忙。这是到目前为止我的代码 public class GetLocationService extends Service { protected LocationManager locationManager; Button start; @Override public IBinder onBind(Intent arg0) { //

我正在创建一项服务,每5分钟更新一次用户位置。我正在使用DDMS将坐标发送到模拟器。我想转换坐标并找到位置。我该怎么做?我是android新手,请帮忙。这是到目前为止我的代码

 public class GetLocationService extends Service {
protected LocationManager locationManager;
Button start;

@Override
public IBinder onBind(Intent arg0) {
    // TODO Auto-generated method stub
    return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId){
    LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
    LocationListener ll = new MyLocListener();
    Location location = new Location("abc");
    ll.onLocationChanged(location ); 
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, ll);
    return START_STICKY;
}

 private class MyLocListener implements LocationListener {
public void onLocationChanged(Location location) {
    if (location != null) {
    Log.d("LOCATION CHANGED", location.getLatitude() + "");
    Log.d("LOCATION CHANGED", location.getLongitude() + "");
    }
    Toast.makeText(GetLocationService.this,
    location.getLatitude() + "" + location.getLongitude(),
    Toast.LENGTH_LONG).show();

    }
  }

}
试试这个:

try{
 Geocoder geo = new Geocoder(youractivityclassname.this.getApplicationContext(), Locale.getDefault());
 List<Address> addresses = geo.getFromLocation(latitude, longitude, 1);
  if (addresses.isEmpty()) {
        yourtextfieldname.setText("Waiting for Location");
  }
  else {
     if (addresses.size() > 0) {       
        Log.d(TAG,addresses.get(0).getFeatureName() + ", 
         " + addresses.get(0).getLocality() +", 
         " + addresses.get(0).getAdminArea() + ",
         " + addresses.get(0).getCountryName());

     }
  }
}
catch (Exception e) {
    e.printStackTrace(); 
}
试试看{
Geocoder geo=新的地理编码器(youractivityclassname.this.getApplicationContext(),Locale.getDefault());
列表地址=geo.getFromLocation(纬度,经度,1);
if(addresses.isEmpty()){
yourtextfieldname.setText(“等待位置”);
}
否则{
如果(addresses.size()>0){
Log.d(标记,地址.get(0).getFeatureName()+“,
“+地址.get(0).getLocation()+”,
“+地址.get(0).getAdminArea()+”,
“+地址.get(0.getCountryName());
}
}
}
捕获(例外e){
e、 printStackTrace();
}

您的意思是从经纬度获取位置(如谷歌地图中的地址)?不,我没有使用任何地图。我的意思是使用geocoder类将坐标转换为位置,你能解释一下你想要的位置吗?这是一个用户可以理解的位置,比如“美国纽约第八大道620号”?是的,就像纽约一样。非常感谢。我检查过的.getFeatureName()附近有一个语法错误,当我在这个页面中发帖时断行时就会出现这个错误。复制和粘贴时应删除打断线。