I have several activities that use custom layouts for a preference activity. The style is as follows.
public class SettingsActivity extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
Toolbar toolbar = (Toolbar) findViewById(R.id.tool_bar);
//Configure toolsbar
//more custom stuff using "findViewById"
PreferenceScreen root = getPreferenceManager().createPreferenceScreen(this);
setPreferenceScreen(root);
//Add preferences
}
The problem is that on Android 6.0, setContentView isn't working for me. findViewById returns null, where it returns the Toolbar on API 9-API22. Did this change? What is going on here?