【发布时间】:2015-12-19 07:58:33
【问题描述】:
我遇到了错误。
Activity com.act.hyd.app.EmtyActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@416e8bb8 that was originally added here
在初始屏幕中,我将检查应用程序的版本代码。如果版本不合适,则显示AlertDialog。但是我得到了上述错误。如何解决它。
public void incorrectMessages(){
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
context);
// set title
alertDialogBuilder.setTitle("Your Title");
// set dialog message
alertDialogBuilder
.setMessage("Click yes to exit!")
.setCancelable(false)
.setPositiveButton("Yes",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, close
// current activity
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(browserIntent);
}
})
.setNegativeButton("No",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.dismiss();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
Toast.makeText(getApplicationContext(), "Dear ACT Customer your App looks old version .Please upgrade from Playstore ", Toast.LENGTH_LONG).show();
onRestart();
}
【问题讨论】:
-
贴出活动的源代码,我认为你可能不止一次调用警报。
标签: android