I am using a fragment inside an activity. I am using the interfrace from the activity to handle the visibility of a view (specifically a linear progress indicator). I am able to handle it. The fragment view is updated but the previous state of the fragment is still visible in the background.
Below is the code which is setting the interface in the parent activity
private void addCallbacks(){
Class<? extends FragmentActivity> activity = requireActivity().getClass();
if(activity == HomeActivity.class){
((PARENT_ACTIVITY)requireActivity()).setProcessCallbackFrgDashboard(new AppCallback() {
@Override
public void update(boolean status) {
updateLoadingStatus(status);
}
});
}
}
And calling addCallback in onViewCreated method of the fragment.
I have set the onClickListener on the red rectangle to set its visibility to gone when clicked.
But after clicking on it ... the rectangle is removed but the previous view is also below it.

