package com.example.android.quakereport;

import android.os.Bundle;
import android.preference.PreferenceFragment;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

/**
 * Created by Don on 6/6/2017.
 */

public class SettingsActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.settings_activity);
    }

    public static class EarthquakePreferenceFragment extends PreferenceFragment {
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            addPreferencesFromResource(R.xml.settings_xml);
        }
    }
}

@@ -54,16 +54,96 @@
 oid.
-os.Bundl
+content.SharedPreferences;%0Aimport android.os.Bundle;%0Aimport android.preference.Preferenc
 e;%0Ai
@@ -187,16 +187,61 @@
 agment;%0A
+import android.preference.PreferenceManager;%0A
 import a
@@ -688,16 +688,65 @@
 ragment 
+implements Preference.OnPreferenceChangeListener 
 %7B%0A      
@@ -922,16 +922,811 @@
 gs_xml);
+%0A%0A            Preference minMagnitude = findPreference(getString(R.string.settings_min_magnitude_key));%0A            bindPreferenceSummaryToValue(minMagnitude);%0A        %7D%0A%0A        @Override%0A        public boolean onPreferenceChange(Preference preference, Object o) %7B%0A            String stringValue = o.toString();%0A            preference.setSummary(stringValue);%0A            return true;%0A        %7D%0A%0A        private void bindPreferenceSummaryToValue(Preference preference) %7B%0A            preference.setOnPreferenceChangeListener(this);%0A            SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(preference.getContext());%0A            String preferenceString = preferences.getString(preference.getKey(), %22%22);%0A            onPreferenceChange(preference, preferenceString);
 %0A       

Add preference value on settings activity