FileDocCategorySizeDatePackage
SettingsActivity.javaAPI DocAndroid 5.1 API2512Thu Mar 12 22:22:42 GMT 2015com.example.android.networkusage

SettingsActivity

public class SettingsActivity extends android.preference.PreferenceActivity implements android.content.SharedPreferences.OnSharedPreferenceChangeListener
This preference activity has in its manifest declaration an intent filter for the ACTION_MANAGE_NETWORK_USAGE action. This activity provides a settings UI for users to specify network settings to control data usage.

Fields Summary
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle savedInstanceState)

        super.onCreate(savedInstanceState);

        // Loads the XML preferences file.
        addPreferencesFromResource(R.xml.preferences);
    
protected voidonPause()

        super.onPause();

        // Unregisters the listener set in onResume().
        // It's best practice to unregister listeners when your app isn't using them to cut down on
        // unnecessary system overhead. You do this in onPause().
        getPreferenceScreen()
                .getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
    
protected voidonResume()

        super.onResume();

        // Registers a callback to be invoked whenever a user changes a preference.
        getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
    
public voidonSharedPreferenceChanged(android.content.SharedPreferences sharedPreferences, java.lang.String key)

        // Sets refreshDisplay to true so that when the user returns to the main
        // activity, the display refreshes to reflect the new settings.
        NetworkActivity.refreshDisplay = true;