Android Open Source - legacy_bluetrack Settings Activity

From Project

Back to project page legacy_bluetrack.


The source code is released under:

GNU General Public License

If you think the Android project legacy_bluetrack listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.jonblack.bluetrack.activities;
/*w w w . j  a v  a2 s  . co  m*/
import org.jonblack.bluetrack.R;


import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.PreferenceManager;

public class SettingsActivity extends SherlockPreferenceActivity implements OnSharedPreferenceChangeListener
    private EditTextPreference mScanDelayPreference;
    public void onCreate(Bundle savedInstanceState)
      // Load the preference from xml
      // Get references to preferences
      mScanDelayPreference = (EditTextPreference) getPreferenceScreen().findPreference("pref_tracking_scan_delay");
    public void onResume()
      SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
      // Set initial values by calling the preference change handler manually.
      onSharedPreferenceChanged(sharedPrefs, "pref_tracking_scan_delay");
      // Register preference change listener
    public void onPause()
      SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
                                          String key)
      // A preference value has changed. Some options show their value in the
      // summary. If one of those options has changed, update the summary.
      if (key.equals("pref_tracking_scan_delay"))
        int scanDelay = Integer.parseInt(sharedPreferences.getString(key, ""));
        String summary = getString(R.string.pref_tracking_scan_delay, scanDelay);

Java Source Code List