GLBasic forum

Main forum => GLBasic - en => Topic started by: planetm on 2012-Sep-02

Title: Android - How to deal with losing focus?
Post by: planetm on 2012-Sep-02
One (or maybe two) more questions from me, I really appreciate the supportive nature of these forums, thank you for all your help!

How do you deal with your android games losing focus? If I switch to another app during my game, then when returning the game starts back on the main menu. I figure I need to use GLB_ON_PAUSE and GLB_ON_RESUME. Do I have to save all the variables and current game state to an .ini file or similar in GLB_ON_PAUSE then load it all in GLB_ON_RESUME or is there a simpler approach?

One other unrelated question: is there a way to add a hyperlink from my app to open a webpage in the browser?

Thanks,

Matt.
Title: Re: Android - How to deal with losing focus?
Post by: Schranz0r on 2012-Sep-02
maybe this? :

Code (glbasic) Select
AUTOPAUSE FALSE
Title: Re: Android - How to deal with losing focus?
Post by: planetm on 2012-Sep-03
Quote from: Schranz0r on 2012-Sep-02
maybe this? :

Code (glbasic) Select
AUTOPAUSE FALSE

Thanks for the reply. I gave this a try, but the app just freezes with a black screen when I return to it.
Title: Re: Android - How to deal with losing focus?
Post by: MrTAToad on 2012-Sep-03
Task switching in Android is not fully support in 10.283.  I think it is in the beta of V11, but never got around to testing it.

More about it here : http://www.glbasic.com/forum/index.php?topic=7901.msg66011#msg66011
Title: Re: Android - How to deal with losing focus?
Post by: spacefractal on 2012-Sep-03
GLB_ON_RESUME is never invoked. This due neither onWindowFocusChanged() or onResume() is called in SDLActivity.java on resume. They only works if you leave the device and close its self.

Same behavier in v10 and the early v11 beta.

So until this got fixed, you should save when pause is invoked, which does call just before quit.
Title: Re: Android - How to deal with losing focus?
Post by: planetm on 2012-Sep-03
Thanks for the replies.
Title: Re: Android - How to deal with losing focus?
Post by: planetm on 2012-Sep-07
Quote from: planetm on 2012-Sep-02
is there a way to add a hyperlink from my app to open a webpage in the browser?

Can anybody answer this question from my original post? I would like to add a couple of hyperlinks from my android app to various websites. How can I do it?

Thanks again,

Matt.
Title: Re: Android - How to deal with losing focus?
Post by: MrTAToad on 2012-Sep-07
The "easiest" way would be to use a font where all characters are underlined.  Detect a click between the x,y -> width, height and then call NETWEBEND
Title: Re: Android - How to deal with losing focus?
Post by: planetm on 2012-Sep-09
Thanks MrTAToad, don't know why i didn't find NETWEBEND myself :S