You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.
Hi, I have my dialog with a custom layout and I need to get the views for that layout when the Dialog is inflated. Here is my code: final Dialog dialog = new Dialog(view.getContext()); dialog.positiveAction("Ok") .negativeAction("Cancel") .contentView(R.layout.chronometer_picker) .backgroundColor(attributes.getBackgroundColor()) .titleColor(attributes.getPrimaryTextColor()) .cancelable(true) .negativeActionClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //Use a View from the layout... RadioButton button = view.findViewById(R.id.buttonId); dialog.cancel(); } }) .title("Choose the Chronometer") .show();
In this case findViewById throws a null pointer exception if I use the button so my question is how to instanciate my button even if the layout is not inflated.
My tought is to do it programmatically but is a complex layout.
Thanks.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi, I have my dialog with a custom layout and I need to get the views for that layout when the Dialog is inflated. Here is my code:
final Dialog dialog = new Dialog(view.getContext()); dialog.positiveAction("Ok") .negativeAction("Cancel") .contentView(R.layout.chronometer_picker) .backgroundColor(attributes.getBackgroundColor()) .titleColor(attributes.getPrimaryTextColor()) .cancelable(true) .negativeActionClickListener(new View.OnClickListener() { @Override public void onClick(View view) { //Use a View from the layout... RadioButton button = view.findViewById(R.id.buttonId); dialog.cancel(); } }) .title("Choose the Chronometer") .show();
In this case findViewById throws a null pointer exception if I use the button so my question is how to instanciate my button even if the layout is not inflated.
My tought is to do it programmatically but is a complex layout.
Thanks.
The text was updated successfully, but these errors were encountered: