Question

I'm developing a Android desktop app, and I would like that when it first starts it (confirm with user and) set itself as default action for Home button.

Currently, this option is given to the user by the Android system only when he first press the Home button after running my app.

Actually, I want the "back" button to not return to the default desktop, as my app will be the default desktop. Maybe the solution for this is the same of the one for the Home button?

Any idea how to do this?

Was it helpful?

Solution

You cannot do this.

OTHER TIPS

Why not just let the system do it for you when the user presses the Home button for the first time. It's what the user is expecting. He/she doesn't expect it to change automatically and personally I would find that quite annoying if it did that since I like choosing my Home screen constantly.

As for the back button, simply add an onKeyDown/Up handler for the KeyEvent.KEYCODE_BACK event to return true (meaning handled by you, not the system). If you do that, it will not leave your app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top