Simplest yes/no dialog fragment

后端 未结 4 900
無奈伤痛
無奈伤痛 2020-12-12 16:55

I\'d like to make a dialog fragment that asks \"Are you sure?\" with a \"yes/no\" reply.

I\'ve looked at the documentation and it\'s really verbose, go

4条回答
  •  青春惊慌失措
    2020-12-12 17:37

    For those coding with Kotlin and Anko, you can now do dialogs in 4 lines of code:

    alert("Order", "Do you want to order this item?") {
        positiveButton("Yes") { processAnOrder() }
        negativeButton("No") { }
    }.show()
    

提交回复
热议问题