I have a Player fragment where I am hiding a View in inactive state of fragment. I am using setUserInteractionListener() in fragment to do this but the problem is it's applying on other fragments as well which I don't want. Can anyone help me with this? Is there any another option to interact with inactive fragment after 5 seconds?
I want to show below toast message only in player fragment but because of onUserInteraction() it shows on every fragment.
((MyActivity) getActivity()).setUserInteractionListener(this);
runnable = () -> {
Toast.makeText(getActivity(), "User is not interact from last 5 seconds", Toast.LENGTH_SHORT).show();
};
handler.postDelayed(runnable, 7000);