자주 사용되는 diallog를 A 클래스에 모아서 사용하고싶습니다.
A 클래스 내 alerdialog 코드입니다.
public static AlertDialog.Builder f_message_q(Context context, String code, String arg) {
// 미완성
if (code.equals("JPNO_DEL")) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("삭제처리");
builder.setMessage(arg + " 전표번호를 삭제하겠습니까?")
.setCancelable(false)
.setPositiveButton("취소",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.setNegativeButton("삭제",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//????
}
});
return builder;
}
return null;
}
B Activity에서 위의 A 클래스에서 선언한 dialog를 호출하여
삭제 버튼을 누르면 B Activity 내에서
지정한 메서드를 호출하고 싶습니다.
여러가지 고민하다 return 값을 builder로 하긴 했지만 return 은 바꿔도 상관없습니다.
방법이 없을까요 ? 많은 조언 부탁드립니다.