「Android/kotlin/Alert」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==okのみ== <pre> AlertDialog.Builder(context) .setTitle("タイトル1") .setMessage("文章1") .setPositiveButton("OK") { dialog, which -> } .s...」) |
|||
行5: | 行5: | ||
.setMessage("文章1") | .setMessage("文章1") | ||
.setPositiveButton("OK") { dialog, which -> | .setPositiveButton("OK") { dialog, which -> | ||
+ | Log.i("AlertDialog", "OK") | ||
} | } | ||
.show() | .show() | ||
行14: | 行15: | ||
.setMessage("文章1") | .setMessage("文章1") | ||
.setPositiveButton("OK") { dialog, which -> | .setPositiveButton("OK") { dialog, which -> | ||
+ | Log.i("AlertDialog", "OK") | ||
} | } | ||
.setNegativeButton("Cancel"){ dialog, which -> | .setNegativeButton("Cancel"){ dialog, which -> | ||
+ | Log.i("AlertDialog", "Cancel") | ||
} | } | ||
.show() | .show() | ||
</pre> | </pre> |
2020年3月27日 (金) 14:39時点における版
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()