-
Notifications
You must be signed in to change notification settings - Fork 0
/
kotlin_snippet
28 lines (19 loc) · 941 Bytes
/
kotlin_snippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
******************************************************************************************************************************
show alert dialog
******************************************************************************************************************************
private fun showDialog(){
val builder = AlertDialog.Builder(this)
builder.setTitle("Title")
builder.setMessage("Message")
builder.setIcon(android.R.drawable.ic_dialog_alert)
builder.setPositiveButton("Yes"){dialogInterface, which ->
Toast.makeText(applicationContext,"clicked No",Toast.LENGTH_LONG).show()
}
builder.setNeutralButton("Cancel"){dialogInterface , which ->
}
builder.setNegativeButton("No"){dialogInterface, which ->
}
val alertDialog: AlertDialog = builder.create()
alertDialog.setCancelable(false)
alertDialog.show()
}