我收到错误消息。活动com.act.hyd.app.EmtyActivity泄漏了最初在此处添加的窗口[email protected]
Activity com.act.hyd.app.EmtyActivity has leaked window [email protected] 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();
}
的可能重复【活动已泄漏最初加入窗口(http://stackoverflow.com/questions/2850573/activity-has-leaked-window-that-was-originally-added ) –
发布活动的源代码,我认为你可能会多次调用警报。 – MAOL