虽然在按下中性按钮时没有提到关闭或关闭对话框,但我的应用程序仍然觉得按下时需要关闭对话框。AlertDialog中性按钮消除对话框
任何想法为什么?
dialogBox = (AlertDialog) dialogBoxHandler.locationDialog();
dialogBox.setButton(DialogInterface.BUTTON_NEUTRAL, "Use Current Location", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
EditText latitude = (EditText) dialogBox.findViewById(R.id.dl_et_latitude);
EditText longitude = (EditText) dialogBox.findViewById(R.id.dl_et_longitude);
LocationManager lm = (LocationManager) MessageSelection.this.getSystemService(Context.LOCATION_SERVICE);
try {
Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER);
double currentLongitude = location.getLongitude();
double currentLatitude = location.getLatitude();
latitude.setText(Double.toString(currentLatitude));
longitude.setText(Double.toString(currentLongitude));
Log.d(TAG, "Latitude " + currentLatitude + " Longitude " + currentLongitude);
} catch (SecurityException e){
Log.d(TAG, e.toString());
}
}
});
dialogBox.show();
问题并不清楚......你是否想在中性按钮按下时关闭对话框? – rafsanahmad007
@ rafsanahmad007不,我不想关闭 – Sean