我要在stationListSetup 這個方法裡使用到
getLocation方法裡的
變數 lonnxx,lonnyy
要怎麼用??
private void locationServiceInitial() {
lms = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
bestProvider = lms.getBestProvider(criteria, true);
Location location = lms.getLastKnownLocation(bestProvider);
getLocation(location);
}
private void getLocation(Location location) {
if (location != null) {
// TextView lonxx_txt = (TextView) findViewById(R.id.textxx);
// TextView lonyy_txt = (TextView) findViewById(R.id.textyy);
Double lonnxx = location.getLongitude();
Double lonnyy = location.getLatitude();
// lonxx_txt.setText(String.valueOf(lonnxx));
// lonyy_txt.setText(String.valueOf(lonnyy));
} else {
Toast.makeText(this, "無法定位座標", Toast.LENGTH_LONG).show();
}
}
public void stationListSetup() {
}
getLocation方法裡的
變數 lonnxx,lonnyy
要怎麼用??
private void locationServiceInitial() {
lms = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
bestProvider = lms.getBestProvider(criteria, true);
Location location = lms.getLastKnownLocation(bestProvider);
getLocation(location);
}
private void getLocation(Location location) {
if (location != null) {
// TextView lonxx_txt = (TextView) findViewById(R.id.textxx);
// TextView lonyy_txt = (TextView) findViewById(R.id.textyy);
Double lonnxx = location.getLongitude();
Double lonnyy = location.getLatitude();
// lonxx_txt.setText(String.valueOf(lonnxx));
// lonyy_txt.setText(String.valueOf(lonnyy));
} else {
Toast.makeText(this, "無法定位座標", Toast.LENGTH_LONG).show();
}
}
public void stationListSetup() {
}