Re: How to end SDLActivity correctly

hardcoredaniel <[email protected]> Wed, 14 Dec 2016 16:59:48 +0100 (CET)
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
Hi,

Android apps are not automatically unloaded even after the onDestroyed() 
callback, e.g. when they are in the destroyed lifecycle state. They will 
only be removed from memory if more recently started apps would require 
memory themselfes. This is probably intentional to have a faster re-start of
apps.

As a consequence, all code needs to be "re-startable", e.g. not relying on 
static initialization which is only executed when the code/the library is 
initially loaded into memory. (There was also a posting to this list where a
method is described that removes this requirement from native code, but it 
means more effort to place all your code into an additional native library 
which you unload upon onDestroy())

I guess that in your case the app successfully enters the "destroyed" state,
but upon restart sth. goes wrong because some code does not work when being 
called a 2nd time. You should see that in the stacktrace when your app 
crashes.

Regards,

Daniel



---------- Původní zpráva ----------
Od: Edition Chamäleon <[email protected]>
Komu: [email protected]
Datum: 14. 12. 2016 16:46:35
Předmět: [SDL] How to end SDLActivity correctly

" 

Hello World,

I'm trying to find a way to end my android App correctly, which is native 
and based on SDLActivity.
Ending the hard way via homebutton always works. But now I want to implement
an exitbutton in my app which enables the user to end it more elegant.

So when the button has been triggered, I'm cleaning all up, killing all my 
singletons and leave my mainloop. Then I "return 0" out of "int main(int 
argc, char* argv[])". That's all on native side.
The app ends seemingly. But when I press homebutton on my device, I can see 
that the app is still there on standby. Shocked 
If I try to open it, it crashes and there comes the black screen with "... 
has been stoped". 
And only then the app is really gone.

This is not elegant. Confused 

Can anyone help me ? 

Thanx in advance, 

Michael

_______________________________________________ 
SDL mailing list 
[email protected] 
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org 
"

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org