Can we add a counter when home button is clicked in android?
问题 I know that home button cannot be stopped or override. Is there a way to extend the home button in a way then when it is click, my counter should be increasing without disturbing any functionality of the home button. 回答1: Try the following code, it works: HomeWatcher mHomeWatcher = new HomeWatcher(this); mHomeWatcher.setOnHomePressedListener(new OnHomePressedListener() { @Override public void onHomePressed() { // do something here... } @Override public void onHomeLongPressed() { } });