Develop
2015.07.09 10:04
[android] AlertDialog 메시지 창 띄우기
Views 982 Comment 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
No. | Category | Subject | Author | Date | Views |
---|---|---|---|---|---|
781 | Develop | [js] 웹페이지에서 특정 엘리먼트 드래그, 복사, 컨텍스트메뉴, 키보드 막기 | hooni | 2013.11.04 | 30132 |
780 | Develop | [ios] 테이블뷰셀/뷰에 배경 패턴 넣기.. | hooni | 2013.04.23 | 29857 |
779 | Develop | [ios] iCloud관련 저장 디렉토리 | hooni | 2013.04.23 | 29676 |
778 | Develop | [ios] 소소한 팁 (Rect,Point,Path,URL 등) | hooni | 2013.08.08 | 29530 |
777 | Develop | [ios] Objective-C 문자열 잘라서 배열(NSArray)에 넣기 | hooni | 2013.04.23 | 29452 |
776 | Develop | [ios] NSMutableString 문자열 패턴 교환 | hooni | 2013.04.23 | 29023 |
775 | Develop | [js] JSON 컨트롤.. 재귀호출로 값 출력하기 | hooni | 2013.04.23 | 28677 |
774 | Develop | [c++] mfc 파일 한줄씩 읽기.. ㅋㅋ | hooni | 2013.04.23 | 28635 |
773 | Develop |
[c] C로 구현한 CGI - 계산기 (링크리스트, 스택, 이진트리)
![]() |
hooni | 2003.04.23 | 28155 |
772 | Develop |
[ios] DJBros. (DJ요맨~)
![]() |
hooni | 2013.04.23 | 28137 |
771 | Develop | [ios] Objective-C 특정 문자 찾아 제거하기 | hooni | 2013.04.23 | 28104 |
770 | Develop | [ios] 코코아 프레임워크(Cocoa Framework) 기본적인 내용~ | hooni | 2013.04.23 | 27724 |