Can not create Alert Dialog
<p>I am overriding the back button . i want to show user a confirmation dialog when leaving my application. while creating the dialog i got the following error</p>

<pre><code> Activity com.example.netlogger.ActivityLogin has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@49ffa7b8 that was originally added here
04-16 16:47:40.885: E/WindowManager(7757): android.view.WindowLeaked: Activity com.example.netlogger.ActivityLogin has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@49ffa7b8 that was originally added here
04-16 16:47:40.885: E/WindowManager(7757):  at android.view.ViewRoot.&lt;init&gt;(ViewRoot.java:247)
04-16 16:47:40.885: E/WindowManager(7757):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
04-16 16:47:40.885: E/WindowManager(7757):  at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
04-16 16:47:40.885: E/WindowManager(7757):  at android.view.Window$LocalWindowManager.addView(Window.java:424)
04-16 16:47:40.885: E/WindowManager(7757):  at android.app.Dialog.show(Dialog.java:241)
04-16 16:47:40.885: E/WindowManager(7757):  at com.example.netlogger.ActivityLogin.onBackPressed(ActivityLogin.java:130)
04-16 16:47:40.885: E/WindowManager(7757):  at android.app.Activity.onKeyUp(Activity.java:1888)
04-16 16:47:40.885: E/WindowManager(7757):  at android.view.KeyEvent.dispatch(KeyEvent.java:1063)
04-16 16:47:40.885: E/WindowManager(7757):  at android.app.Activity.dispatchKeyEvent(Activity.java:2068)
04-16 16:47:40.885: E/WindowManager(7757):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1703)
04-16 16:47:40.885: E/WindowManager(7757):  at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2473)
04-16 16:47:40.885: E/WindowManager(7757):  at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2443)
04-16 16:47:40.885: E/WindowManager(7757):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1735)
04-16 16:47:40.885: E/WindowManager(7757):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-16 16:47:40.885: E/WindowManager(7757):  at android.os.Looper.loop(Looper.java:123)
04-16 16:47:40.885: E/WindowManager(7757):  at android.app.ActivityThread.main(ActivityThread.java:4633)
04-16 16:47:40.885: E/WindowManager(7757):  at java.lang.reflect.Method.invokeNative(Native Method)
04-16 16:47:40.885: E/WindowManager(7757):  at java.lang.reflect.Method.invoke(Method.java:521)
04-16 16:47:40.885: E/WindowManager(7757):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
04-16 16:47:40.885: E/WindowManager(7757):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
04-16 16:47:40.885: E/WindowManager(7757):  at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>My code is the following</p>

<pre><code>@Override
    public void onBackPressed() {
        super.onBackPressed();
        SharedPreferences prefs = PreferenceManager
                .getDefaultSharedPreferences(this);
        if (!prefs.getBoolean("ask_for_exit", false)) {
            exitAlertDialog = new Builder(ActivityLogin.this)
                    .setTitle("Are You Sure?")
                    .setMessage("Are you sure you want to exit")
                    .setPositiveButton("YES",
                            new DialogInterface.OnClickListener() {

                                @Override
                                public void onClick(DialogInterface dialog,
                                        int which) {
                                    finish();
                                }
                            })
                    .setNegativeButton("NO", new DialogInterface.OnClickListener() {

                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    exitAlertDialog.dismiss();
                                }
                    }).create();
            exitAlertDialog.show();

        }
    }
</code></pre>

<p>What's this error means? if there is any clue please let me know. Thanks!</p>
