I'm writing an app using the NDK/openGL and I have a question
regarding how I should handle the lifecycle events (i.e. onPause(),
onResume() etc).
Looking at the lifecycle chart in the docs, I will get an onPause()
call when I get sent to the background, which is fine, but if the
system decides it needs more memory it will kill my app and I lose all
my memory. However I won't have any idea my memory has been released
and the next time the user gos to my app, I will get an onCreate()
call. All the lifecycle events call functions in my C-side code so I
can do initialization and cleanup etc.

This is where I am confused. Currently in onCreate() I check for if my
pointers are NULL before allocating memory so when I get the
onCreate() after the onPause(), I still expect my memory to be there
and I therefore don't allocate any more. This obviously causes big
problems down the road when I try and access some memory which isn't
mine anymore.
Can I safely assume that if I'm in onCreate(), I will need to
reallocate all my memory and that all pointers I have are now invalid
(and have been safely cleaned up by the system)?
Thanks!

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