getActionBar() returns null in PreferenceActivity (AppCompat-v7 21)
问题 I have implemented DoneBar (two buttons in actionbar) in PreferenceActivity as provided in v20 sdk samples, but after updating SDK and AppCompat to version 21 my app crashes at java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ActionBar.setDisplayOptions(int, int)' on a null object reference That is because getActionBar() returns null. And There is no getSupportActionBar() as in ActionBarActivity . So my question is how to get that actionbar object in