Answer the question
In order to leave comments, you need to log in
Can buttons be controlled?
There is CustomDialogFragment extends AppCompatDialogFragment
in it I define two buttons:
AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
builder
.setView(customDialog)
.setPositiveButton(android.R.string.ok, this)
.setNegativeButton(android.R.string.cancel, null)
.create());
Answer the question
In order to leave comments, you need to log in
Can.
AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
AlertDialog dialog = builder
.setView(customDialog)
.setPositiveButton(android.R.string.ok, this)
.setNegativeButton(android.R.string.cancel, null)
.create());
dialog.setOnShowListener(dialogInterface ->
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(view -> {
// тут код
dialog.dismiss();
}
}));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question