Preference Change Listener

github: T06.05_PreferenceChangeListener

* Reference: Udacity Nanodegree Program- Become an Android Developer *

Screen Shot 2018-03-06 at 4.00.29 PM


// TODO (1) Implement OnSharedPreferenceChangeListener
public class VisualizerActivity extends AppCompatActivity implements OnSharedPreferenceChangeListener {
// TODO (2) Override the onSharedPreferenceChanged method and update the show bass preference
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
// TODO (3) Register the listener
//because this class already implements OnSharedPreferenceChangeListener so we can put 'this' here.
// TODO (4) Override onDestroy and unregister the listener
protected void onDestroy() {


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s