2
sonraki AlerDialog oluşturmasını EditText alınır? Kullanıcı "Tamam" düğmesine bastıktan sonra girilen bir metne sahip olmak istiyorum.Nasıl fragmanı
sonraki AlerDialog oluşturmasını EditText alınır? Kullanıcı "Tamam" düğmesine bastıktan sonra girilen bir metne sahip olmak istiyorum.Nasıl fragmanı
deneyin böyle yapmak:
LayoutInflater inflater = getActivity().getLayoutInflater();
View dialogView = inflater.inflate(R.layout.add_subcontractor_form, null);
alert.setView(dialogView);
EditText editText = (EditText) dialogView.findViewById(R.id.et_sub_name);
AlertDialog.Builder alert = new AlertDialog.Builder(appContext);
// inflate your view
View inflatedView = LayoutInflator.from(appContext).inflate(R.layout.add_subcontractor_form)
// find the edittext
final EditText input = (EditText) inflatedView.findViewById(R.id. et_sub_name)
alert.setTitle("Add subcontractors")
.setView(inflatedView);
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String YouEditTextValue = input.getText().toString();
}
});
alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// what ever you want to do with No option.
}
});
alert.show();
Harika, bana uyar. Çok teşekkür ederim – neustart47