在底部更新
我编写了一个记录用户位置,当前速度,平均速度和最高速度的应用程序.我想知道如何使应用程序执行以下操作:
这是我写的代码.(如果你愿意,可以随意使用它,如果你对如何改进它有任何建议,我对建设性批评持开放态度:D)
package Hartford.gps;
import java.math.BigDecimal;
import android.app.Activity;
import android.content.Context;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.widget.TextView;
public class GPSMain extends Activity implements LocationListener {
LocationManager locationManager;
LocationListener locationListener;
//text views to display latitude and longitude
TextView latituteField;
TextView longitudeField;
TextView currentSpeedField;
TextView kmphSpeedField;
TextView avgSpeedField;
TextView avgKmphField;
//objects to store positional information
protected double lat;
protected double lon;
//objects to store values for current and average speed
protected double currentSpeed;
protected …Run Code Online (Sandbox Code Playgroud)