In normal Android applications you can declare variables in your Activity static. Then, if you touch the home or the back sign, and then come back later to the same app, the static variables will have kept their value, and the onCreate method can recreate your app like you left it, using these static variables. This is very convenient, so I tried to achieve the same behavior using SDL and the Android NDK. Alas, I could not find a way.
Who knows how to do this? Which events must be polled? How must the relevant variables be stored? Any help will be much appreciated.
In normal Android applications you can declare variables in your Activity
static. Then, if you touch the home or the back sign, and then come back
later to the same app, the static variables will have kept their value, and
the onCreate method can recreate your app like you left it, using these
static variables. This is very convenient, so I tried to achieve the same
behavior using SDL and the Android NDK. Alas, I could not find a way.
Who knows how to do this? Which events must be polled? How must the
relevant variables be stored? Any help will be much appreciated.
Thanks for your reply, but of course I knew this document already. The problem is however that only the GL context is restored, but an app contains more then that… It is not clear how other variables should be recovered.
Thanks for your reply, but of course I knew this document already. The
problem is however that only the GL context is restored, but an app
contains more then that… It is not clear how other variables should be
recovered.
wboe
I guess I don’t understand your question then, what exactly are you losing
when switching apps that you would like to recover? The SDLActivity is a
singleton and it lives for the entirety of your app’s life, anything you
store there will be always available.–
Gabriel.
You are right! I put my unbelief on hold, recompiled with SDL_ANDROID_BLOCK_ON_PAUSE defined, and it works! Not only the GL context is restored, but the complete app. Thanks!
Thanks!On Tue, Nov 6, 2012 at 8:59 AM, wboe <w.boeke at upcmail.nl> wrote:
**
Hi Gabriel,
You are right! I put my unbelief on hold, recompiled with
SDL_ANDROID_BLOCK_ON_PAUSE defined, and it works! Not only the GL context
is restored, but the complete app. Thanks!