Android/kotlin/Alert
okのみ
AlertDialog.Builder(context)
.setTitle("タイトル1")
.setMessage("文章1")
.setPositiveButton("OK") { dialog, which ->
Log.i("AlertDialog", "OK")
}
.show()
ok,cancelの2択
AlertDialog.Builder(context)
.setTitle("タイトル1")
.setMessage("文章1")
.setPositiveButton("OK") { dialog, which ->
Log.i("AlertDialog", "OK")
}
.setNegativeButton("Cancel"){ dialog, which ->
Log.i("AlertDialog", "Cancel")
}
.show()
枠外クリックでキャンセル防止
setCancelable(false)を追加
AlertDialog.Builder(this)
.setCancelable(false)
参考:http://nishi.sunnyday.jp/Knowledge/Android/tips/AlertDialog/setCancelable