Develop
2015.07.09 10:04
[android] AlertDialog 메시지 창 띄우기
조회 수 849 댓글 0
메세지를 띄우고 [확인] 버튼만 적용할 경우
AlertDialog.Builder alert = new AlertDialog.Builder(MyActivity.this); alert.setPositiveButton("확인", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); //닫기 } }); alert.setMessage("테스트 메세지"); alert.show();
메세지를 띄우고 [확인], [취소] 버튼으로 적용할 경우
AlertDialog.Builder alert_confirm = new AlertDialog.Builder(MyActivity.this); alert_confirm.setMessage("Yes or No?").setCancelable(false).setPositiveButton("YES", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // 'YES' } }).setNegativeButton("NO", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // 'No' return; } }); AlertDialog alert = alert_confirm.create(); alert.show();
[출처] http://shstarkr.tistory.com/144
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
1089 | System/OS | 무료로 HTTPS 적용하기 (Let's Encrypt) | hooni | 2017.10.28 | 1403 |
1088 | Etc | How to completely Uninstall Coda | hooni | 2017.10.24 | 2161 |
1087 | Etc | 영어. 불규칙 동사 정리 | hooni | 2017.10.04 | 3505 |
1086 | System/OS | [linux] iptables 초간단 세팅 스크립트 | hooni | 2017.09.26 | 1239 |
1085 | Develop | [ios] VIN Scanner (VIN barcode) 스캐너 | hooni | 2017.09.16 | 646 |
1084 | System/OS | [mac] Homebrew/rvm/cocoapod setting | hooni | 2017.07.29 | 999 |
1083 | Etc | 캘리포니아 운전면허 문제 | hooni | 2017.07.22 | 978 |
1082 | Develop | [android] 안드로이드 앱 문서 샘플 | hooni | 2017.07.11 | 2107 |
1081 | Develop | [coding] 공부해야 하는거 ㅋㅋ | hooni | 2017.06.27 | 0 |
1080 | Develop | [coding] Find all anagrams in a string | hooni | 2017.06.27 | 1140 |
1079 | Etc | IT감사 기법 시험 | hooni | 2017.06.14 | 1418 |
1078 | Develop | [android] SQLiteOpenHelper를 이용한 DBManager | hooni | 2017.06.14 | 2066 |