Can we intercept HOME button click on android device or emulator.
If no, then which are the methods called before home screen is displayed on pressing HOME key?
I checked by overriding the life cycle methods of activity, it shows onPause() and onStop() are called but they are called even when we switch between the activities?
Any suggestions are appreciated
I don't think you can intercept HOME key presses. It is reserved to ensure that you dont get locked within any application.
You can test this by coding a simple activity and overriding the onKeyDown(..) method. If you run this application and press the home button you will notice that the onKeyDown(..) callback in your code will NOT be invoked. Also, note that your onKeyDown(..) callback will be called only when(this comes straight from API docs) -
Called when a key was pressed down and not handled by any of the views inside of the activity. So, for example, key presses while the cursor is inside a TextView will not trigger the event (unless it is a navigation to another object) because TextView handles its own key presses...
So, I think that proves that you cannot intercept HOME key via onKeyDown(..) atleast. If there are any other means or if you meant something else then I dont know the answer.
As regards your second question -
Pressing the HOME button starts the launcher activity so yes, you are essentially, switching activites.
The intent fired has following properties/attributes(see DDMS->logcat for details):
CallBacks invoked when you press HOME button(listed in order) :