Android AlertDialog for Popup Option Menu

July 24, 2018
val items = arrayOf("Option 1", "Option 2")
AlertDialog.Builder(context)
        // .setTitle("Optional")
        .setItems(items) { _, itemIndex ->
            when (itemIndex) {
                0 -> {
                    // do something
                }
                1 -> {
                    // do something
                }
            }
        }
        .create()
        .show()
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.