분리된 다이얼 로그 메세지
public class TestAsync extends AsyncTask<String, String, String>
{
Context mContext;
CustomDialog dialog;
public TestAsync(Context mContext)
{
this.mContext = mContext;
}
@Override
protected void onPreExecute()
{
dialog = new CustomDialog(mContext);
dialog.createDialog(dialog);
super.onPreExecute();
}
이런식으로
onPreExecute()에서
불러옵니다.
그냥 분리해서 사용하시는분들도
저 2줄만 써주시면 됩니다.
그 다음 따로 분리한 코드를 보면
[CustomDialog.java]
public class CustomDialog extends Dialog
{
public CustomDialog(Context context)
{
super(context);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dialog_custom);
//서버와 연결중일때 FrameAnimation으로 움짤을 넣는다
//ImageView iv = (ImageView)findViewById(R.id.iv);
//frameAnimation = (AnimationDrawable)iv.getBackground();
}
public void createDialog(CustomDialog dialog)
{
// dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
dialog.setCanceledOnTouchOutside(false);
dialog.show();
}
}
출처: https://itpangpang.xyz/293 [ITPangPang]