Search code examples
androidandroid-activityandroid-actionbarandroid-theme

What's the result of calling the Activity's setTitle when its theme is Theme.AppCompat.Light.NoActionBar?


I have an activity whose theme is a child of Theme.AppCompat.Light.NoActionBar. I call getActivity().setTitle("My Title"); from a fragment of this activity and don't see any changes in the UI. If the activity's theme was Theme.AppCompat.Light.DarkActionBar, I would see that the action bar title has changed to "My Title."

Does it make sense to call getActivity().setTitle() when there's no action bar? setTitle has been available since API 1. Back then there was no ActionBar.


Solution

  • well functionality changes over time in api one set title referred to probably the little strip above the app. However now on wards it refers to the action bar. The if you want to set a title with the current api 23 then you need to have an action bar.