I have a problem that I don\'t know how to solve. How do you hide a toolbar in a specific fragment, I have already been searching around on the internet and what I found was com
Create an interface in the fragment and use it to tell the parent activity to hide the toolbar.
Add these lines to your fragment:
private OnEventListener listener;
public interface OnEventListener {
void hideToolbar() ;
}
public void setOnEventListener(OnEventListener listener) {
this.listener = listener;
}
After creating your fragment in the main activity add:
myFragment.setOnEventListener(new MyFragment.OnEventListener() {
@Override
public void hideToolbar() {
getSupportActionBar().hide();
}
});
Whenever you need to hide the toolbar execute:
listener.hideToolbar();
from inside your fragment.