Reputation: 430
I want to know when the user is interacting with my app. I've tried to use Window.Callback
but I faced an issue with Toolbar.
In case we call setSupportActionBar
(setActionBar
) my Window.Callback
doesn't receive events anymore.
Restriction:
I can't extend Activity
. I need one global place to handle all interactions with the app.
Upvotes: 3
Views: 137
Reputation: 2434
You can achieve that with overriding onUserInteraction
method on your activity
@Override
public void onUserInteraction(){
//do what you like here
}
See docs for furhter informations docs
Upvotes: 0
Reputation: 3766
Try onUserInteraction().
Called whenever a key, touch, or trackball event is dispatched to the activity. Implement this method if you wish to know that the user has interacted with the device in some way while your activity is running.
Upvotes: 1