我有一个使用对话框的活动。但是,当我单击对话框时,控制值并关闭对话框。单击对话框时如何不关闭对话框?
private Dialog ekleDialog(){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
View layout = LayoutInflater.from(this).inflate(R.layout.dialog_ekle, null);
builder.setTitle(R.string.ekleAction);
builder.setView(layout);
final EditText tutarEdit = (EditText) layout.findViewById(R.id.editTextTutar);
final EditText aciklamaEdit = (EditText) layout.findViewById(R.id.editTextAciklama);
final RadioButton gelirRadio = (RadioButton) layout.findViewById(R.id.radioGelir);
final RadioButton giderRadio = (RadioButton) layout.findViewById(R.id.radioGider);
builder.setNegativeButton(R.string.dialogCancel, new DialogInterface.OnClickListener() {
@SuppressWarnings("deprecation")
@Override
public void onClick(DialogInterface dialog, int which) {
removeDialog(EKLE);
}
});
builder.setPositiveButton(R.string.dialogKaydet, new DialogInterface.OnClickListener() {
@SuppressWarnings("deprecation")
@Override
public void onClick(DialogInterface dialog, int which) {
float tutar = Float.parseFloat(tutarEdit.getText().toString());
String aciklama = aciklamaEdit.getText().toString();
if(tutarEdit.getText().toString().equals("") || aciklamaEdit.getText().toString().equals("")){
Toast.makeText(MainActivity.this, R.string.toastMesaj, Toast.LENGTH_LONG).show();
**Dialog not close !**
}else{
ekleGelir(tutar, aciklama);
removeDialog(EKLE);
dialog.dismiss();
}
}
});
builder.setCancelable(true);
return builder.create();
}