Skip to content

Commit

Permalink
Dismiss choice dialog when selected
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Feb 20, 2021
1 parent 7e19fea commit 10bcb94
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ fun Activity.showDateInput(title: String, format: String, handler: (Date?) -> Un
fun Activity.showSingleSelection(title: String, selections: List<String>, checkedIndex: Int, handler: (Int) -> Unit) {
val builder = AlertDialog.Builder(this)
builder.setTitle(title)
builder.setSingleChoiceItems(selections.toTypedArray(), checkedIndex) { _, index ->
builder.setSingleChoiceItems(selections.toTypedArray(), checkedIndex) { dialog, index ->
handler(index)
dialog.dismiss()
}

builder.show()
Expand Down

0 comments on commit 10bcb94

Please sign in to comment.