This is due to the order of operations. You are currently setting the toolbar and then loading up the fragment with the toolbar inside. This means when you call setSupportActionBar(toolbar); toolbar will currently be null.

You could potentially solve this by setting the toolbar from within SettingsFragment by calling: