Editing a Custom Dialog Box in Android Studio Kotlin

39 Views Asked by At

To preface this post, I'm pretty new to Android Dev so go easy on me. I'm currently working on the Reset Password feature of an offline only app. When the user clicks on reset password, it pops up a custom dialog box with buttons and TextViews to take in the user information, authenticate it, and if the information is correct they will be shown a new custom dialog box that allows them to enter their new password and hit confirm.

I couldn't quite figure out how to just change the current dialog box, but thought that would be the ideal solution. What I attempted was to call dialog.dismiss(), then immediately pop up a completely separate dialog box that would have a TextView for the new password, and then a confirm button. What happens is that the first dialog box comes up, I enter the information and hit the button, which is followed by the app immediately crashing.

The other thing I thought of that could possibly do it is by using fragments to change the current dialog box, but I'm not sure if that'll work. Ideally I'd like it if I could click confirm on the information confirmation (first)dialog, which would bring to my next dialog with the actual setting of the new password. Thanks

1

There are 1 best solutions below

2
ARJUN YADAV On

Please share the codes as well. By the way if you are using custom layout inside your dialog, then you can change those inflated view using dialog's view reference, and if you are not using the custom layout, then also you can change the text by just changing values through the dialog's view reference.