I am trying to find out why I am getting this error:
java.lang.IllegalStateException: Must specify preferenceTheme in theme at android.support.v7.preference.PreferenceFragmentCompat.onCreate(PreferenceFragmentCompat.java:210) at android.support.v4.app.Fragment.performCreate(Fragment.java:2177) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager
When trying to run my PreferenceFragmentCompat This is the above class code:
public class SettingsFragment extends PreferenceFragmentCompat { public SettingsFragment() {
This is an activity manifest declaration showing a snippet
<activity android:name=".active_minutes_screen.view.ActiveMinutesActivity" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity>
Code that shows a snippet in the above MainActivity
FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.content_frame, HistoryFragment.newInstance()); ft.commit();
Theme that I apply through MainActivity
<style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="preferenceTheme">@style/PreferenceThemeOverlay</item> </style>
source share