As the title, I have two problems: 1. Hook power key- I need detect and prevent power key. 2. When screen is off, i need to handle event foe volume,menu,back key press.
Asked
Active
Viewed 1,712 times
-2
-
1hello, you should provide sample of your code. Did you try to use search engine on SO ? – deadfish Mar 01 '13 at 10:01
-
I have been seaching for it. But I have no answer for my problems. Maybe you don't understand all off my question, else please give me the link. – TheTG Mar 01 '13 at 11:47
1 Answers
-1
KeyEvents stackoverflow This link lets you know how to handle onKeyUp/Down event.
For Back key detection use KEYCODE_BACK
For Volume Keys use KEYCODE_VOLUME_DOWN and KEYCODE_VOLUME_UP
OnStop() lifecycle method of a activity is called when power button is pressed.

Community
- 1
- 1

Rachita Nanda
- 4,509
- 9
- 42
- 66
-
-
Thanks for pointing out I'have made the edit .Refer to Activity life cycle . http://developer.android.com/training/basics/activity-lifecycle/stopping.html .Hope it helps – Rachita Nanda Mar 01 '13 at 11:13