Will you please anyone let me know how to change the Message (Body) of an alert dialog in onPrepareDialog().
I am not able to find any function like setText() even after typecasting the Dialog parament in the onPrepareDialog() function.
I dont want to use
removeDialog()
showDialog()
as it will be overhead to GC to clean the objects and if i go for custom dialog then code becomes huge for handling in case of themes.
Please let me know if anyone have idea of changing the text of an AlertDialog in the onPrepareDialog() function.
Thanks & Regards,
SSuman185
Step 1: Create a XML file: custom_layout. Add the below code in custom_layout. xml. This code defines the alertdialog box dimensions and add a edittext in it.
Alert Dialog shows the Alert message and gives the answer in the form of yes or no. Alert Dialog displays the message to warn you and then according to your response the next step is processed. Android Alert Dialog is built with the use of three fields: Title, Message area, Action Button.
The way to make a checkbox list is to use setMultiChoiceItems . // setup the alert builder AlertDialog. Builder builder = new AlertDialog. Builder(context); builder.
Within onPrepareDialog
just use:
((AlertDialog) dialog).setMessage("my text goes here");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With