Develop
2015.07.09 10:04
[android] AlertDialog 메시지 창 띄우기
조회 수 852 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
93 | Develop | [ios] 테이블뷰셀/뷰에 배경 패턴 넣기.. | hooni | 2013.04.23 | 29815 |
92 | System/OS | [linux] 랜카드가 2개 일 때 네트워크 설정 | hooni | 2003.04.23 | 30034 |
91 | Develop | [js] 웹페이지에서 특정 엘리먼트 드래그, 복사, 컨텍스트메뉴, 키보드 막기 | hooni | 2013.11.04 | 30063 |
90 | Etc | 영작 연습을 위한 실용영어 문장 1001개 (1~500) | hooni | 2013.06.21 | 30428 |
89 | System/OS | [linux] 특정 문자열 포함된 파일 찾는 명령어 | hooni | 2013.10.16 | 30618 |
88 | System/OS | [mac] 맥에서 슬립(잠자기) 모드 진입을 막는 방법~ | hooni | 2013.10.10 | 30888 |
87 | Etc | 성문 종합 영어 정리된 pdf 파일 | hooni | 2013.06.25 | 30973 |
86 | Develop | 서기의 PHP 동영상 강의(싱싱해) | hooni | 2013.05.15 | 30982 |
85 | Develop | [android] 디바이스(시뮬레이터) hosts 파일 수정하기 | hooni | 2013.04.23 | 31077 |
84 | Develop | [js] jQuery 관련 문서 ㅎㅎ | hooni | 2013.04.23 | 31225 |
83 | Develop | [ios] 개발 기초 가이드 링크.. | hooni | 2013.04.23 | 31370 |
82 | System/OS | Mac OS X - Apache+PHP+MySQL 환경 서버 | hooni | 2013.04.25 | 31629 |