0

How to change the title bar inside a fragment? Somewhat I am not able to succeed.

setTitle("My new title");
getActionBar().setIcon(R.drawable.my_icon);
Cœur
  • 37,241
  • 25
  • 195
  • 267
Antonin GAVREL
  • 9,682
  • 8
  • 54
  • 81
  • 1
    http://stackoverflow.com/questions/14483393/how-do-i-change-the-android-actionbar-title-and-icon – Infinite Recursion Oct 24 '14 at 07:08
  • I suggest that you try to change that from your activity, if that succeeds than you have your problems in your fragment. If not than you must have some piece of code in activity that doesn't allow you to change that. – Ultimo_m Nov 18 '14 at 14:48

1 Answers1

0

I think the problem is that you can't access the ActionBar APIs from the fragment. So, what you need is an access to the Parent Activity.

Try : getActivity().setTitle("My new title");

Shivam Verma
  • 7,973
  • 3
  • 26
  • 34