As a followup this had no impact.  Also it wasn't an OutOfMemoryError
when it it got bubbled up to my activity, it was an InflateException.
Catching the exception seemed to have no impact, it still crashed.  I
tried this:

//not having much luck fixing our OutOfMemoryErrors, so lets see what
happens if we just catch and log it.  Might be nicer to the user.
try {
        setContentView(R.layout.arl_start);
} catch (OutOfMemoryError e) {
        GlobalUtils.outOfMemoryCount++;
        Log.e(getClass().getCanonicalName(),"GlobalUtils.outOfMemoryCount
"+GlobalUtils.outOfMemoryCount);
        e.printStackTrace();
        finish();
} catch (InflateException e) {
        GlobalUtils.outOfMemoryCount++;
        Log.e(getClass().getCanonicalName(),"GlobalUtils.outOfMemoryCount
"+GlobalUtils.outOfMemoryCount);
        e.printStackTrace();
        finish();
}

On Dec 11, 11:19 am, Matt Kanninen <[email protected]> wrote:
> Can I ask what Android does with un caught OutOfMemoryErrors that it
> wouldn't do if I caught them?  It's really tempting for me to do this:
>
> try {
>             setContentView(R.layout.result);} catch (OutOfMemoryError E) {
>
>            outOfMemoryCount++;
>              e.printStackTrace();
>               finish();
>
> }
>
> If I don't catch the OutOfMemory my activity crashes, but then the
> user just clicks the button again and it loads great the second time.
> So something happens resulting in the rightmemorybeing cleared.

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