Android Question rapid debug crashes camera


Licensed User
Is there a way to run a command/script before the debugger restarts the code?
Unless i release the camera politely it crashes necessitating an android restart?
At the moment i try to remember to release it first by backing out of the activity that's controlling it but more often than not i get so wound up that If orget!
(thanks in advance and apologies if its covered elsewhere)
PS Just Love b4a, still cant believe erel wrote it for me!