728x90
AlertDialog.Builder(this)
.setTitle("제목")
.setMessage("내용")
.setPositiveButton("확인"){dialog,id->
// 확인버튼 클릭시 코드블럭
dialog.dismiss()
}
.setNegativeButton("취소"){dialog,id->
// 취소버튼 클릭시 코드블럭
dialog.dismiss()
}.show()
간단히 Dialog 띄우는 코드입니다.
.show() 를 붙여주지 않는다면 Dialog 는 뜨지 않습니다.
dialog.dismiss()
띄워진 Dialog 를 닫는 함수입니다.
'한국 20대 개발자의 성장기' 카테고리의 다른 글
| 나만의 뽀모도로 만들기 (2) | 2023.08.30 |
|---|---|
| [Kotlin] MutableList clear (0) | 2022.12.12 |
| [kotlin] 안드로이드 레트로핏2 이미지 전송(업로드) / Android retrofit2 image upload to php (0) | 2022.12.06 |
| [Kotlin] NestedScrollView 이용하여 스크롤 부드럽게 만들기 (0) | 2022.12.05 |
| [Koltin] 화면 전환 부드럽게 하기 (0) | 2022.12.05 |