[Android] ProgressDialog Exception


Writing time : 2012-12-04 04:04:43

ProgressDialog Exception

If you call the show member function of ProgressDialog and call the show member function again without calling the dismiss function, the following exception occurs.

12-03 16:32:00.970: E/WindowManager(13573): Activity kr.co.xxxxxxxx has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43800e48 that was originally added here   
12-03 16:32:00.970: E/WindowManager(13573): android.view.WindowLeaked: Activity kr.co.xxxxxxxx has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@43800e48 that was originally added here   
12-03 16:32:00.970: E/WindowManager(13573):  at android.view.ViewRootImpl.<init>(ViewRootImpl.java:403)   
12-03 16:32:00.970: E/WindowManager(13573):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:311)   
12-03 16:32:00.970: E/WindowManager(13573):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224)   
12-03 16:32:00.970: E/WindowManager(13573):  at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149)   
12-03 16:32:00.970: E/WindowManager(13573):  at android.view.Window$LocalWindowManager.addView(Window.java:554)   
12-03 16:32:00.970: E/WindowManager(13573):  at android.app.Dialog.show(Dialog.java:277)  

Especially, it occurs mainly when the ProgressDialog object is saved as a member as in the code below. Exception can be prevented by calling the dismiss function before calling the show function.

/* 이미 보여지고 있는 경우는 숨김처리한다 */  
if(m_progressDlg != null){  
m_progressDlg.dismiss();  
}  
m_progressDlg = ProgressDialog.show(this, szTitle, szMsg, true, true);  
Previous post

Next post