I've got one activity and a lot of fragments.
One of my fragments is full screen and has CollapsingToolbarLayout
.
It was added by .add
by fragment manager.
I need toolbar, buttons etc, on my fragment:
But for this I need to set toolbar for activity like this:
((MyActivity)getActivity()).setSupportActionBar(toolbarFromFragment);
But after that I can't change title of activity. I tried a lot of ways, like getting CollapsingToolbarLayout
from fragment and setting title to it, or making it static, etc. Also I tried to set toolbar again from findViewById
. And other ways from google, but no one helps.
How I can resolve this problem? I need to set own toolbar to this fragment, and then dynamically change title.