.. は、私はこの送信値の場所は
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LocationManager locationManager;
String context = Context.LOCATION_SERVICE;
locationManager = (LocationManager)getSystemService(context);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);
criteria.setCostAllowed(true);
criteria.setPowerRequirement(Criteria.POWER_LOW);
String provider = locationManager.getBestProvider(criteria, true);
//Location location = locationManager.getLastKnownLocation(provider);
updateWithNewLocation(null);
locationManager.requestLocationUpdates(provider, 2000, 10,
locationListener);
}
private final LocationListener locationListener = new LocationListener() {
public void onLocationChanged(Location location) {
updateWithNewLocation(location);
}
public void onProviderDisabled(String provider){
updateWithNewLocation(null);
}
public void onProviderEnabled(String provider){ }
public void onStatusChanged(String provider, int status,
Bundle extras){ }
};
private void updateWithNewLocation(Location location) {
//EditText etlat=(EditText)findViewById(R.id.lat);
//EditText etlong=(EditText)findViewById(R.id.lng);
if (location != null) {
double lat = location.getLatitude();
System.out.println(lat);
double lng = location.getLongitude();
System.out.println(lng);
double alt = location.getAltitude();
System.out.println(alt);
etlat.setText(String.valueOf(lat));
etlng.setText(String.valueOf(lng));
etalt.setText(String.valueOf(alt));
}
}
のような場所(緯度・経度)を取得するためのコードを持っているし、私は私の場所を保存したい10分後に続きます
どうすればいいですか?ありがとう:)
私は10分の間隔でタイマーを設定することができますか? – akubabas
このリンクをチェックしてくださいhttp://stackoverflow.com/questions/4044726/how-to-set-a-timer-in-java – NullPointerException
私はこのコードを私のコードに入れますか?ありがとう:) – akubabas