Andrew, got a kink I can't seem to work past. I've uploaded what I've got so far.
It all starts at script.chain() sub. In a nutshell, script.chain() sets main.chainscript to the filename of the program to chain to, and main.chainargs to the args passed. It then calls blib.halt and activity.finish, then exits. Then main.activity_resume catches control and if there is a filename in main.chainscript, it loads and processes it and stores it in script.chainprogram, and sets script.args to the array that was passed to main.chainargs. The next step is calling startactivity("script"), (this is where it fails...) and exit. Then, as described below, if I am stepping through all this, it acts correctly and script.activity_create catches control. It looks for chainprogram having a zero length. If it's not an empty string, it sets the program var from the contents of chainprogram (which was set to the source code of the chained program from main.activity_resume), clears both chainprogram and main.chainscript and exits the conditional block. Control then follows the normal route of loading the code from the program var and running it.
But... activity script never comes back up. The display seems to blink instantly, then the main activity comes back up. But heres the thing: If i'm in debug mode, stepping through main.activity_resume, it works! every time... But not in debug or release mode if it is 'running' instead of 'stepping'. Here's another observation... If I press my devices HOME button, then start B4Script again, it goes right into the script activity as if it's been there the whole time, but just never took focus... I added a log entry just above the startactivity statement, just so I'd know it was making it that far. The last log entry might tell you something, but since there's no error number, I'm lost...
Here are the log entries
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.warsoftapps.b4script/.main bnds=[437,336][535,455] } from pid 808
Unable to create files directory
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
Displayed com.warsoftapps.b4script/.main: +365ms
Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@40976388
Starting: Intent { flg=0x20000 cmp=com.warsoftapps.b4script/.script } from pid 17057
** Activity (main) Pause, UserClosed = false **
** Activity (script) Create, isFirst = true **
Displayed com.warsoftapps.b4script/.script: +466ms
** Activity (script) Resume **
** Activity (script) Pause, UserClosed = true **
Client not active, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@4064e988
** Activity (main) Resume **
Attempting to start activity Script for chaining
Starting: Intent { flg=0x20000 cmp=com.warsoftapps.b4script/.script } from pid 17057
Got RemoteException sending setActive(false) notification to pid 16904 uid 10157
I'm pulling my hair out trying to get this 'dance' to go right.
Help???
ps. You may notice from the uploaded project that I'm still on v2.8. I wasn't going to upgrade to 2.9 until I got this all worked out.
ps. here are the scripts I'm testing this with:
prg1.src
Code:
msgbox("chaining to prg2", "prg1")
chain(filedirrootexternal & "/B4Script", "prg2.src", "")
msgbox("sorry, didn't make it
prg2.src
Code:
setactivitytitle("prg2")
msgbox("made it!", "prg2")
msgbox(arraylen(args), "")
appreciate you help. again >blush<