How to pass custom list in affolstad material dialog for multi selection?

Yes you can pass custom list to afollestad’s Material Dialogs.

As this library gives you functionality to use custom views, you can definitely create a custom layout and add multi-selection logic onto that view, and then add that custom view to Material Dialog.

To add a custom layout, use the below code:

val dialog = MaterialDialog(this, dialogBehavior).show {
  customView(R.layout.custom_view, scrollable = true, horizontalPadding = true)
  positiveButton(R.string.connect) { dialog ->
    // Pull the list out of the custom view when the positive button is pressed
  lifecycleOwner([email protected])

For the logic about multi-selection, read this article.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top