Is there a way to get the positive button of a DialogPreference
in any of its events?
I would like to disable it initially, and make it enabled once a EditText
validates.
Is there a way to get the positive button of a DialogPreference
in any of its events?
I would like to disable it initially, and make it enabled once a EditText
validates.
Simply call
(AlertDialog)dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
If you are using a Dialog Builder though, make sure you call this after builder.create()
and before .show()
You can then keep a reference to the dialog and enable the button once your conditions are fulfilled.
builder.create()
and show()
method executed. Before show()
return was null. –
Szymanski © 2022 - 2024 — McMap. All rights reserved.