简体   繁体   中英

Dialog class where the message can be modified dynamically

I am looking for a Dialog class where the message that is set to an instance of the class (eg, via setMessage) can be changed depending on the situation. Is this possible? Or are messages that are set permanent (thereby requiring a new instance of the Dialog)?

I guess you mean AlertDialog , because as @Sam says, Dialog has no setMessage() method. Of course, you can use the same AlertDialog instance. Just setMessage() and show. Just keep in mind you will lose previous message.

Unlike AlertDialog , the generic Dialog doesn't have a setMessage() method. You can use findViewById() to find the TextView you passed to setContentView() and call setText() on that. Or just use an AlertDialog if appropriate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM