how to add buttons dynamically in Alert Box in Android
问题 I am developing android application in which for validations, it displays messages with alert box. I wanted to add buttons dynamically according to certain conditions. I like ask how to do this? I searched on Google, but couldn't find any suitable solutions. Any Suggestions are helpful. Thanks. 回答1: You can use a DialogFragment to acheive it. Create your own dialog view and inflate it in the onCreateView() of the dialog fragment. 回答2: if you know the possible buttons that could be displayed: