0

I have one requirement like for home fragment I want to show default navigation icon with title and for other fragments I want to use back button icon with title . How Can I do that ?

  • I tried this but that didn't work for me. I have a main activity and multiple fragments for different items.When I am in home fragment I want to show default navigation icon with title and for other fragments I want to use back button icon with title. – user2553586 Nov 22 '17 at 11:25
  • See [this](https://stackoverflow.com/questions/36579799/android-switch-actionbar-back-button-to-navigation-button) . – ADM Nov 22 '17 at 11:27
  • Down vote due to duplicate question, there are a lot of posts answering this, just google it. – patrick.elmquist Nov 22 '17 at 12:23
  • @ADM Thanks for the link.Exactly what i was looking for. – user2553586 Nov 22 '17 at 16:39

1 Answers1

3

use this code in your fragment onResume()

((Toolbar)getActivity().findViewById(R.id.toolbar)) .setNavigationIcon (R.drawable.my_icon);
Abhishek Singh
  • 9,008
  • 5
  • 28
  • 53