views:

131

answers:

3

Essentially, I just want to change the home button from just hiding my app to killing the activity that is on the screen.

I thought about writing a broadcast receiver that kills the activity, but I'm not sure how to kill the activity from the receiver.

How do I change the functionality of the home button to "finish" the specific activity?

Thanks

+3  A: 

How do I change the functionality of the home button to "finish" the specific activity?

You don't. The most you can do is create an SDK application that implements an alternative home screen. You cannot otherwise alter the HOME button behavior from the SDK.

However, you are welcome to roll your own firmware and have the HOME button do whatever you want for your own phone, or other phones you can arrange to get that firmware.

CommonsWare
so there's no way to intercept the intent and add some code that closes out my activity?When you hit the home button, are any of the onPause/onStop events called? It seems like a bad idea to just shove what was running in the background and not allow any customization.
Alex
"so there's no way to intercept the intent and add some code that closes out my activity?" Correct. "When you hit the home button, are any of the onPause/onStop events called?" Both are. They are also called when the user presses the BACK button, when a call comes in, when the user selects a notification, and other circumstances. Whatever problem you think you're trying to solve by changing the behavior of the HOME button, there is probably a better solution.
CommonsWare
Thanks for the response. I'll rethink how I'm doing things.
Alex
+1  A: 

You CANNOT intercept the home button.

Period!

:)

MasterGaurav
A: 

Not true, Check out toddler lock application.

emre