안녕하세요
A라는 클래스에서 다이얼로그를 메서드로 만들었습니다.
근데 B라는 클래스에서 A의 다이얼로그메서드를 불러와서 띄워줄수가 잇습니까??
인플레이트 레이아웃을 사용해서 다이얼로그를 생성했습니다.
AlertDialog.Builder builder;
AlertDialog alertDialog;
Context mContext = getParent();
LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(LAYOUT_INFLATER_SERVICE);
View dialog_layout = inflater.inflate(R.layout.option_dialog_layout, (ViewGroup)findViewById(R.id.layout_root));
builder = new AlertDialog.Builder(mContext);
builder.setView(dialog_layout);
alertDialog = builder.create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
return alertDialog;
요론 식으로요 ...
B클래스에서 어떠한 다이얼로그에서 "예"를 눌렀을 때 나와야 하거든요..
.setPositiveButton("확인",
new DialogInterface.OnClickListener() {
public void onClick(
DialogInterface dialog,
int which) {
Tab1_Home home = new Tab1_Home();
home.다이얼로그 메서드이름.show();
}
해도 안되거ㅜㅜ
어떻게 해야 뜰까요?




A클래스에서
public static AlertDialog createDialog(Context context)
{
AlertDialog.Builder builder;
AlertDialog alertDialog;
Context mContext = getParent();
LayoutInflater inflater = (LayoutInflater)context.getSystemService(LAYOUT_INFLATER_SERVICE);
View dialog_layout = inflater.inflate(R.layout.option_dialog_layout, (ViewGroup)findViewById(R.id.layout_root));
builder = new AlertDialog.Builder(mContext);
builder.setView(dialog_layout);
alertDialog = builder.create();
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
return alertDialog;
}
로 함수를 하나 생성하신후..
B클래스에서 AlertDialog alert = A.createDialog(B.this);
식으로 호출 하시면 될것 같은데요~