"alert", I am guessing, is static, and when you rotate the device,
your activity is destroyed, but alert is kept.

You'll probably want to do something like alert.dismiss() in your
onDestroy. Then you need to remember to start it up again in onCreate.

Though it would be highly recommended to move towards Fragments (with
the support library) and use DialogFragments instead - higher learning
curve, but a lot less headache.


On Feb 2, 3:40 pm, vani reddy <[email protected]> wrote:
> Hi friends,,
> Under tabs when onBackPressed i am showing a dialog box, but its throwing
> the below exception
>
> ERROR/WindowManager(979): Activity com.amplyfyme.android.HomeScreen has
> leaked window
> com.android.internal.policy.impl.PhoneWindow$DecorView@40678fb0 that was
> originally added here
>
> Toast.makeText(getParent(), "inside back prsseeeeeeee",
> Toast.LENGTH_SHORT).show();
>             AlertDialog.Builder builder = new
> AlertDialog.Builder(getParent());
>             builder.setMessage("Are you sure you want to exit?")
>                     .setCancelable(false)
>                     .setPositiveButton("Yes",
>                             new DialogInterface.OnClickListener() {
>                                 public void onClick(DialogInterface dialog,
>                                         int id) {
>                                     UserProfileActivity.this.finish();
>                                 }
>                             })
>                     .setNegativeButton("No",
>                             new DialogInterface.OnClickListener() {
>                                 public void onClick(DialogInterface dialog,
>                                         int id) {
>                                     dialog.cancel();
>                                 }
>                             });
>         alert= builder.create();
>         alert.show(); //line where exception is thrown
>
> --
> Regards,
> Vani Reddy

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to