Android Open Source - brutefir-remote Preferences

From Project

Back to project page brutefir-remote.


The source code is released under:

GNU General Public License

If you think the Android project brutefir-remote 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

 * Copyright (c) 2011 Victor Su//from  ww  w.j  a  va  2s .c om
 * This program is open source. For license terms, see the LICENSE file.

package com.vsu.bruteremote;

import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;

public class Preferences extends PreferenceActivity implements OnSharedPreferenceChangeListener {
  // The preference key for IP address.
  public static final String KEY_PREF_IP_ADDRESS = "ip_address";

  // The preference key for port.
  public static final String KEY_PREF_PORT = "port";

    // Reference to the IP address preference.
    private EditTextPreference mPrefIpAddress;

    // Reference to the port preference.
    private EditTextPreference mPrefPort;

     * Called when the activity is first created.
     * @param savedInstanceState  If the activity is being re-created from a previous
     *                            saved state, this is the state.
  public void onCreate(Bundle savedInstanceState) {

    // Load the XML preferences file

    // Get a reference to the preferences
        mPrefIpAddress = (EditTextPreference)findPreference(KEY_PREF_IP_ADDRESS);
        mPrefPort = (EditTextPreference)findPreference(KEY_PREF_PORT);

     * Called when the activity is resumed.
    protected void onResume() {

        // Set up the initial values

        // Set up a listener whenever a key changes

     * Called when the activity is paused.
    protected void onPause() {

        // Unregister the listener whenever a key changes

     * Called when shared preferences change.
     * @param sharedPreferences  Reference to shared preferences.
     * @param key                The preference key.
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
      Preference pref = findPreference(key);

        if (pref instanceof EditTextPreference) {
            EditTextPreference editTextPref = (EditTextPreference) pref;

          if (key.equals(KEY_PREF_IP_ADDRESS)) {
          } else if (key.equals(KEY_PREF_PORT)) {

Java Source Code List