Develop
2015.07.09 10:04
[android] AlertDialog 메시지 창 띄우기
조회 수 985 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
121 | Develop | [ios] 앱에서 다른 앱 실행시키기 | hooni | 2013.09.05 | 18629 |
120 | Develop | [ios] libxml/tree.h file not found | hooni | 2013.08.08 | 18768 |
119 | Develop | [ios] Objective-C에서 형식이 있는 문자열(Format Strings)에 사용할 수 있는 토큰들(Tokens) | hooni | 2013.04.23 | 18842 |
118 | Develop | URI 인코딩, URL 인코딩 | hooni | 2013.04.23 | 18905 |
117 | Develop | 모터에 대한 pid 제어.. ㅎㅎ | hooni | 2013.04.23 | 18939 |
116 | Develop | [js]모바일 웹에서 orientationchange | hooni | 2013.04.23 | 19430 |
115 | Develop | [php] XE 에서 php 구문 사용하기 (XE 템플릿에서) | hooni | 2013.10.31 | 19539 |
114 | Develop | [c] AES 알고리즘 (암호화/복호화) | hooni | 2003.04.23 | 20146 |
113 | Develop | [c] UTF-8을 EUC-KR로 변환.. (iconv) | hooni | 2013.04.23 | 20204 |
112 | Develop | [ios] UIView에서 상위 UIViewController 가져오기 | hooni | 2013.09.27 | 20253 |
111 | Develop | [php] substr() 한글 자를 때 깨짐 방지 | hooni | 2014.01.09 | 20442 |
110 | Develop | [android] [번역] 안드로이드 Android Cloud to Device Messaging(C2DM) | hooni | 2013.04.23 | 20482 |