How do I know if my Android Home button is pressed?

How do I know if my Android Home button is pressed?
Answer
It is impossible to detect and/or intercept the HOME button from within an Android app. This is built into the system to prevent malicious apps that cannot be exited. Modifying this code that it only reacts on home button press is straighforward. Override onUserLeaveHint() in the activity.
 

Tìm kiếm

Back
Top