Hi everyone,
is it possible by any chance to communicate directly between the SDLActivity.java and global variables in GLBasic? I would like to be able to change the Android Back Button's behavior based on the state of a global variable in the GLBasic app, or even better be able to change the variable inside the SLDActivity.java. Possible or not?
Thank you!
no.
But howover you can do a javacall to change example a variable in a java array trought a java call. one to set that, and another one to get that. here was that im was doing to do, but did not update to the ANDROIDEXTRAS:
In Public static String glb_JAVACALL(String url):
// --== IS MENU SHOWHING? ==--
if (tokens[0].equals("setMenuShow"))
{ doMenuShow=false;
if (tokens[1].equals("1") || tokens[1].equals("true") doMenuShow=true;
}
In the top, just under public class SDLActivity extends Activity or >>>>>>>> START OF ANDROID EXTRAS <<<<<<<< :
private boolean doMenuShow = false;
Then in doKeydown() event, you could do something like this:
if (keyCode == KeyEvent.KEYCODE_BACK)
{ if (event.isAltPressed()) { return false; } // prevent quit if circle is pressed on Xperia Play
if (doMenuShow==false) { return false; } // prevent back button to work
}
This is just giving you ideas.
Hi,
I copied the code from fivesprites and inserted the rest at the specified locations, but now I am getting a fatal error:
gpc_temp0.o:gpc_temp0.cpp:(.text+0x7e06): undefined reference to `_android_JAVACALL'
Seems like the function is ignored by the compiler?
Ok, don't bother, working now. :)
EDIT: Haha, ok - I got it all working, but the point is that on my 2.2.2 Phone the return false on Keypress Back Button doesn't make any difference at all.
It's might been a bug on the phone with wrong implement. but if it's does on the v4 device, you should write the part of the code.