我收到錯誤消息。活動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