Hey boxers, I've seen a lot of threads around about how to create a exit button that works more or less on Android, so I've made a quick setup / a way to do this and I'm gonna share a step by step tutorial below. Please note that this is not the correct way of doing it but at least is something. Let's begin: Buildbox Setup 3.x.x On your UI screen drag and drop a Navigation button Set the Name to be Exit Button (name is important! Set Function to Custom Add your images save and export your game to Android. Check the red marks below: Android Studio Setup: Open PTServicesBridge class Scroll down until you see buttonActivated method Now here you must add the following lines of code just after the last if statement Code: if(name.contains("Exit Button")) { activity.finish(); System.exit(0); } Save the project, deploy it to a telephone and enjoy your custom button. Congratulations you've just created your first custom exit button behavior. IMPORTANT NOTES: The naming of the Navigation button has to match the name that is checked in the if condition. Otherwise this won't work and you can't exit your app. On most of the cases for android when the activity is closed/finished the app will exit but it will still be available on quickview list (or the place where you can see all your opened app and you swipe up or down to close them) As I said before this is not something that is intended to be working based on Java standards but it is something that I wanted to share with the community. Any suggestion/improvement would be greatly appreciated and I will happily edit this thread with the proper way of doing things based on your feedback. That's it for now, stay safe, have fun creating games and I will see you in my next thread!
Buildbox Setup 2.x.x On your UI screen drag and drop a Navigation button Set the Name to be Exit Button (name is important! Set Function to Custom Add your images save and export your game to Android. Check the red marks below: Android Studio Setup: Open AdIntegrator class Scroll down until you see buttonActivated method Now here you must add the following lines of code just after the last if statement If you got name defined in between brackets use this with the if statement Code: if(name.contains("Exit Button")) { activity.finish(); System.exit(0); } otherwise use this code Code: activity.finish(); System.exit(0); Save the project, deploy it to a telephone and enjoy your custom button. Congratulations you've just created your first custom exit button behavior on Buildbox 2 Please let me know if you have any issues with the above tutorial. Also a video on how it works is greatly appreciated
Hi @Vlad-NY Thanks for sharing this tutorial Could you please tell us which buildbox version are you using ? I have tried version 2.3.9 but I couldn't find the code in PTServicesBridge class
I've updated my 2nd post with the setup for buildbox 2. For some reason on my export I have the name missing from buttonActivated meaning that you can't have multiple custom buttons that does multiple stuff since this method would be called every time you click on your custom button. If you guys have the name there please use it to create multiple behaviors based on your needs. As far as I know the iOS export might have the name there so you should be fine there. Stay safe, have fun, and see you soon!