我正在使用 Android 注释。有一个进度对话框,但是当我旋转屏幕时(着陆到端口)。进度对话框关闭并在 log cat 中显示这些错误。
活动 com.example.progressdialog.AnnotationProgressDialogActivity_ 泄露了最初添加在这里的窗口 com.android.internal.policy.impl.PhoneWindow$DecorView@40661c20
android.view.WindowLeaked: 活动 com.example.progressdialog.AnnotationProgressDialogActivity_ 已经泄露了最初添加在这里的窗口 com.android.internal.policy.impl.PhoneWindow$DecorView@40661c20
这是我的代码:-
@EActivity(R.layout.main)
public class AnnotationProgressDialogActivity extends Activity
{
@NonConfigurationInstance
ProgressDialog pd ;
@NonConfigurationInstance
@Bean
BackgroundTask bgt;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
@Click
public void loginButton()
{
pd = ProgressDialog.show(this,"Login", "Loading please wait.....");
bgt.backGroundMethod();
}
public void dismissDialog()
{
pd.dismiss();
}
}
enter code here
@EBean
public class BackgroundTask
{
@RootContext
Activity apda;
@Background
public void backGroundMethod()
{
try
{
TimeUnit.SECONDS.sleep(10);
update();
}
catch(Exception e)
{
Log.e("Error",""+e);
}
}
@UiThread
public void update()
{
//((AnnotationProgressDialogActivity)apda).updateUI();
((AnnotationProgressDialogActivity)apda).dismissDialog();
}
}