我正在尝试制作一个跟踪用户移动的应用程序。 到目前为止,我已经显示的位置的应用程序和“速度”带GPS的运动跟踪器使用LocationListener
protected void onCreate(Bundle savedInstanceState);
setContentView(R.layout.main);
txt = (TextView)findViewById(R.id.textView);
LocationManager locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
LocationListener locationListener = new MyLocationListener();
locationListener.requestLocationUpdates(LocationManager.GPS_PROVIDER,5000,10,locationListener);
}
private class MyLocationListener implements LocationListener
{
public void onLocationChanged(Location loc){
String longitude = "Long: "+ loc.getLongitude();
String latitude = "Lat: "+ loc.getLatitude();
txt.setText(longitude + latitude);
}
这是我的代码。 但我想得到我的速度,行程距离以及最大和最小高度。 如果任何人都可以帮忙,请做,它将不胜感激!
'protected void onCreate(Bundle savedInstanceState);'是那个';'一个错字? –
其实不是:D –