AlertDialog 는 대화상자를 띄우는 클래스입니다.
JAVA code
AlertDialog.Builder builder = new AlertDialog.Builder(this);
# this는 내 액티비티를 말하며 getActivity()로 가능
builder.setTitle("AlertDialog text!!!!");
builder.setMessage("테스트 내용입니다.!!!");
# 버튼을 생성합니다.
builder.setPositiveButton("문자값!!", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
# 버튼을 누르면 어떤 작업을 처리할지 입력합니다.!
}
});
# 문자값의 해당하는 네거티브 버튼을 만듭니다.
builder.setNegativeButton("문자값!!", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
# 버튼을 누르면 어떤 작업을 처리할지 입력합니다.!
}
});
AlertDialog ad = builder.create();
ad.show()
'개발 > 안드로이드' 카테고리의 다른 글
Android - CountDownTimer (0) | 2023.01.30 |
---|---|
Android - ProgressBar (0) | 2023.01.30 |
Android - LinearLayout (0) | 2023.01.30 |
android - ImageView (1) | 2023.01.30 |
Android - Log (0) | 2023.01.30 |