Thursday, September 8, 2011

Re: [android-developers] Dialog dismiss()

On Thu, Sep 8, 2011 at 2:29 PM, TreKing <trekingapp@gmail.com> wrote:
> On Thu, Sep 8, 2011 at 2:14 PM, Greg Donald <gdonald@gmail.com> wrote:
>>
>> How can I keep my dismiss() calls from blowing up?
>
> Keep a class-level reference to the dialog and dismiss it if you're being
> destroyed.

Well, I just have the one instance I reuse everywhere already. And if
what you said below about it being asynchronous is true, then my other
checks to see if it's still around could still pass later.

I don't get why if( this != null ) evaluates to true when the stack
trace seems to imply the Activity is gone already.

> 2 - You rotate device while it's still showing.

Exactly what I'm hearing. Rotate, boom.

>>  Why doesn't try/catch work?
>
> I *think* because dismiss is asynchronous - calling dismiss just puts the
> dialog in the queue for cleanup. I think.

Geez.. I'm thinking I might just lock it in to landscape mode and
forgo the grief.


--
Greg Donald

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

No comments:

Post a Comment