Java 检查字符串是否为空,并设置默认字符串
以下方法从用户电话获取gps位置。 我想设置默认字符串“无GPS位置”。如果 纬度和经度尚未获得 当它们为“0.0,0.0”时,成功地执行ie。 我在哪搞砸了Java 检查字符串是否为空,并设置默认字符串,java,location,double,Java,Location,Double,以下方法从用户电话获取gps位置。 我想设置默认字符串“无GPS位置”。如果 纬度和经度尚未获得 当它们为“0.0,0.0”时,成功地执行ie。 我在哪搞砸了 public void getLocation(){ gpsTracker = new GpsTracker( LocationPickerActivity.this); if(gpsTracker.canGetLocation()){
public void getLocation(){
gpsTracker = new GpsTracker( LocationPickerActivity.this);
if(gpsTracker.canGetLocation()){
double latitude = gpsTracker.getLatitude();
double longitude = gpsTracker.getLongitude();
String noGps = "No GPS Location.";
String latLongLocation = latitude +","+ longitude;
if (latLongLocation.trim ().length ()<8){
tvgpslatitudeLongitude.setText ( noGps);
} else {
tvgpslatitudeLongitude.setText ( latLongLocation );
}
}else{
gpsTracker.showSettingsAlert();
}
}
} );
public void getLocation(){
gpsTracker=新的gpsTracker(LocationPickerActivity.this);
if(gpsTracker.canGetLocation()){
双纬度=gpsTracker.getLatitude();
double longitude=gpsTracker.getLongitude();
String noGps=“无GPS位置。”;
字符串latLongLocation=纬度+“,”+经度;
if(latLongLocation.trim().length())