Basic outline of Resources/Activity/Fragment connection:
First, we make SettingsActivity. Then, we create SettingsFragment, in which we write addPreferencesFromResource(R.xml.pref_settings);
to connect it with a resource we created in xml
resource directory.
Finally, we make root layout of activity_settings.xml
a fragment, specifically SettingsFragment, with android:name="com.example.android.myapp.SettingsFragment"
Important note: Must not forget adding a style in styles.xml
. Otherwise, app will crash.