At a very basic level, if you don't trust the activities you are running in
your process to be stable, then you certainly shouldn't be trusting them
enough to load in your own process in the first place.

On Wed, May 20, 2009 at 3:41 AM, Nik Bhattacharya <
[email protected]> wrote:

>
> I wanted to get your opinions on the usage of
> Thread.setDefaultUncaughtException.  Here is my scenario:
>
> I have an activity that starts up a LocalActivityManager, which in
> turn starts up several Activities and pulls in their decor views and
> puts them into current activities view.  However, there is the case
> that a particular activity might be a rogue activity and will cause
> the entire host activity to crash.  One such case is the subactivity
> causes an OutOfMemory exception due to excessive Bitmap allocation.
>
> My thought was that I could make my host application implement
> UncaughtExceptionHandler and assign the Thread's default uncaught
> exception handler to it.  In the handler, I log that an exception
> occurred, and the application can continue for very short period of
> time, but then I get an ANR (Application Not Responding) obviously
> because I am catching a pretty critical exception and not doing
> anything about it other than logging.  Optimally, I would like to shut
> down the offending view that caused the exception, but I am not sure
> how to get that view when I am already in the last stage of trying to
> deal with the exception (the uncaught exception handler callback).
>
> What can I do if I want to keep the architecture of the
> LocalActivityManager that I currently have in place, but harden my
> code against contributing activities that do not cooperate or cause my
> host activity to run out of memory?
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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