이 대화 상자 스 니펫이 있습니다.Dialogs에서 언제 dimiss() 또는 hide()를 호출해야합니까?
String message="This will be my message";
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
alt_bld.setMessage(message)
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{
ProgressDialog dialog1 = ProgressDialog.show(CombatActivity.this, "Loading",
"Pushing OK...", true);
Intent i = new Intent();
i.setClass(MyFirstActivity.this, MySecondActivity.class);
startActivity(i);
finish();
}
});
AlertDialog alert = alt_bld.create();
// Title for AlertDialog
alert.setTitle("Nyertél.");
// Icon for AlertDialog
alert.setIcon(R.drawable.icon);
alert.show();
내 질문 : 이들 중 .hide() 또는 .dismiss()를 호출해야합니까? 메시지 텍스트가 동적으로 읽혀지며 표시된 대화 상자마다 별도의 인스턴스가 필요하지 않습니다. 난 단지 하나만 업데이트 된 메시지를 원한다.
그래서 언제 어떻게 제거해야합니까?
http://stackoverflow.com/questions/2850573/activity-has-leaked-window-that-was-originally-added –