I navigate to other fragments using navigation. And I want to add a condition that if, for example, (profile fragment) is running, then visibility = GONE for the header. Experts help to solve the problementer image description here enter image description here
How to find out which fragment is currently running
hey you can have a look at the below link to find which fragment is currently visible at a certain time
for more info
Android Navigation Architecture Component - Get current visible fragment