본문 바로가기

개발도구/aOS - 안드로이드 개발

[안드로이드] alertdialog 알랏메세지

1. 알럿 다이어로그 생성
AlertDialog.Builder alert = new AlertDialog.Builder(this);

2. 타이틀 설정
alert.setTitle( "안녕" );

3. 메세지 입력
alert.setMessage( "안녕 난 케이라고해" );

4. 버튼이 눌렀을 때 이벤트 등록
alert.setPositiveButton( "닫기", new DialogInterface.OnClickListener() {
    public void onClick( DialogInterface dialog, int which) {      dialog.dismiss();   //닫기
    }
});

5. 알럿 다이어로그 호출
alert.show();