0
我想从一个EditText中获取一个字符串的字符,并且同时想显示当前位置的经度和纬度。EditText问题
这里显示的代码
Button btn=(Button)findViewById(R.id.format);
btn.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
showCurrentLocation();
}
});
protected void showCurrentLocation() {
text=name.getText().toString();
String finalText = "";
finalText = Character.toString(text.charAt(3));
Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location != null) {
String message = String.format(
"Current Location \n Longitude: %1$s \n Latitude: %2$s",
location.getLongitude(), location.getLatitude()
);
Toast.makeText(GPSLocator.this, message,
Toast.LENGTH_LONG).show();
}
}
的一部分编译代码时我给任何字符并单击发送按钮,则显示一条消息在屏幕上像“应用GPSLocator(处理COM之后。 vetexVervelnc GPSLocator)已意外停止,请重试ForSE召开前夕关闭“