Develop
2015.07.09 10:04
[android] AlertDialog 메시지 창 띄우기
조회 수 846 댓글 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
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
745 | Develop | [c] 시간 관련 함수 설명과 예제.. | hooni | 2003.04.23 | 11518 |
744 | Develop | [c] 스토리지 클래스(변수) | hooni | 2003.04.23 | 8197 |
743 | Develop | [c] 포인터와 함수포인터에 대해.. | hooni | 2003.04.23 | 8019 |
742 | Develop | [c] 구조체의 설명과 예제.. | hooni | 2003.04.23 | 8373 |
741 | Develop | [c] 프로세스간의 통신(파이프) | hooni | 2003.04.23 | 6891 |
740 | Develop | [jsp] 정적/동적(차트생성) 이미지 전달 | hooni | 2003.04.23 | 7307 |
739 | Develop | [c] OpenGL 직사각형(2D) 크기 확대/축소 | hooni | 2003.04.23 | 9069 |
738 | Develop | [c++] 더블 링크리스트(linked list) 학습용 초간단 단어장 | hooni | 2003.04.23 | 9323 |
737 | Develop | [c] 구조체/파일 입출력 프로그램 | hooni | 2003.04.23 | 7063 |
736 | Develop | [c] 컴파일러 선행처리기 따라하기.. | hooni | 2003.04.23 | 6681 |
735 | Develop | [c] 싱글, 더블 링크리스트(linked list)로 만든 예제.. | hooni | 2003.04.23 | 6737 |
734 | Develop | [c] fgets() 함수 사용하기.. | hooni | 2003.04.23 | 7818 |