How to make Back emulate Home?
Monkey Targets Forums/Android/How to make Back emulate Home?
| ||
Is it possible to make the Back button act like the Home button? i.e. Suspend the app instead of completely closing it. I know that pressing the Back button calls OnBack, but what do I put in OnBack to suspend the app? |
| ||
Hi Dave, by default that is exactly what it does. It does this to mirror the iPhone button. You only need to edit OnBack() if you want more custom than that. |
| ||
sorry, it appears that's wrong. I was sure that was how it was supposed to behave |
| ||
I've had a good look through the docs and I can't find anything that lets me suspend the app. I'm guessing it's not possible. |
| ||
http://stackoverflow.com/questions/3141996/android-how-to-override-the-back-button-so-it-doesnt-finish-my-activity i don't know if it can be done in monkey, i havn't tried it. can you block the back button using monkey? if so, then you could try injecting some native code in the OnBack() to call home. |
| ||
You can block the Back button simply by overriding App.OnBack() with an empty function. Better to start up an "Exit App (Yes/No)" dialog though IMO. But anyway, App.OnBack() calls App.OnClose(), but you can override it to do whatever you want. |
| ||
I know I can, and how to, override OnBack. My question was, is there a function that suspends the app in the same manner as the home button does? |