Monday, July 25, 2011

[android-developers] Re: Curious NPE

On Jul 25, 6:49 am, Zsolt Vasvari <zvasv...@gmail.com> wrote:
> Actually, I just realized how this can happen.  If I get a checked
> exception in onCreate(), I just display it in a pop-up, which the user
> can dismiss and then press the back button and get the NPE.  Now how a
> checked exception can happen is another very good question, but I
> don't expect help with that.....

A checked exception is one that must be caught from the perspective of
the java compiler (extends Exception). An unchecked exception doesn't
have to be caught (extends RuntimeException). The java compiler will
tell you if a checked exception can be thrown and oblige you to handle
it. Is this what you're talking about?

If you show a dialog in in onCreate, I'm pretty sure the activity
lifecycle is still going to complete. I don't think you can prevent
that. If you don't want the user to interact with the activity at all
after you show a dialog, I'd recommend putting a call to finish() in
the dismiss and cancel handlers for your dialog so that the activity
will be on its way out ASAP.

Doug

--
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