-
-
Notifications
You must be signed in to change notification settings - Fork 297
No way to intercept the back button exiting the app #414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for this observation. The problem is with the transition to Fragment-based sketches, the onBackPressed() method could no longer be used, as it is not defined for Fragments. It could still be added in the main activity that contains the Processing sketch, but it is not immediately obvious what the best implementation could be. One possibility could be to use introspection to determine if the sketch has a function with some predetermined name, such as back(). If it does, call that function, otherwise continue with the default implementation of onBackPressed, so the activity quits:
|
I think onBackPressed() could be added to ActivityAPI, which already contains a number of methods that are available in Activity and useful to implement in PApplet. |
Implemented with 0f54669 |
What's the proper way now to exit from the sketch if |
I can't seem to find a way to stop a Processing app from closing on clicking the back button - I'm trying to implement a page/menu system and the back button exiting no matter what is.. annoying.
In an older Processing version, there was
onBackPressed
, but in this commit, it was commented out. I've tried overridingonDestroy
,keyPressed
,keyReleased
,stop
on all the renderers with no success.Is there a way to do this?
The text was updated successfully, but these errors were encountered: