Android Launcher - Home Button
I'm developing a Home Screen Launcher App for Android. Now, if the user is already on the homescreen, i want a custom action when the user presses the the homebutton. I know some
Solution 1:
Launcher is some kind of activity.
So I believe that you will gain focus when user is pressing the home button. One thing I can tell you for sure. This is possible!
You got setOnFocusChanged() in a View class
Solution 2:
Referencing this post:
You cannot "detect home key Button press event", sorry.
However on the same post Idistic suggests this as a work around:
longuserInteractionTime=0;
@OverridepublicvoidonUserInteraction() {
userInteractionTime = System.currentTimeMillis();
super.onUserInteraction();
Log.i("appname","Interaction");
}
@OverridepublicvoidonUserLeaveHint() {
longuiDelta= (System.currentTimeMillis() - userInteractionTime);
super.onUserLeaveHint();
Log.i("bThere","Last User Interaction = "+uiLag);
if (uiDelta < 100)
Log.i("appname","Home Key Pressed");
else
Log.i("appname","We are leaving, but will probably be back shortly!");
}
Post a Comment for "Android Launcher - Home Button"