Search code examples
javaandroidandroid-dialogfragment

Positive and Negative Button position on a DialogFragment


Is there any way to change the order on which the positive, negative and neutral buttons are shown in a DialogFragment so that I can put for instance the negative button first?

I don't want to change the "nature" of the button but keep them being "positive", "negative" and "neutral".


Solution

  • Try like this:

    builder.setMessage(R.string.dialog_fire_missiles)
               .setPositiveButton()
               .setNeutralButton()
               .setNegativeButton()