Java Code Examples for android.preference.PreferenceScreen

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project android-vpn-settings, under directory /src/com/android/settings/vpn/.

Source file: VpnTypeSelection.java

  22 
vote

private void initTypeList(){
  PreferenceScreen root=getPreferenceScreen();
  for (  VpnType t : VpnManager.getSupportedVpnTypes()) {
    String displayName=t.getDisplayName();
    String message=String.format(getString(R.string.vpn_edit_title_add),displayName);
    mTypeMap.put(message,t);
    Preference pref=new Preference(this);
    pref.setTitle(message);
    pref.setSummary(t.getDescriptionId());
    root.addPreference(pref);
  }
}
 

Example 2

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/controller/.

Source file: SettingsController.java

  22 
vote

/** 
 * Used in SettingsActivity in order to update the %value% placeholder in  the summaries.
 * @param activity Reference to activity
 */
public void registerOnSharedPreferenceChangeListener(PreferenceActivity activity){
  activity.getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
  PreferenceScreen ps=activity.getPreferenceScreen();
  mSummaries.clear();
  for (  String key : ps.getSharedPreferences().getAll().keySet()) {
    Preference pref=ps.findPreference(key);
    if (pref != null && pref.getSummary() != null) {
      mSummaries.put(key,pref.getSummary().toString());
    }
  }
  updateSummaries();
}
 

Example 3

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/deviceinfo/.

Source file: Status.java

  22 
vote

private void setWimaxStatus(){
  ConnectivityManager cm=(ConnectivityManager)getSystemService(CONNECTIVITY_SERVICE);
  NetworkInfo ni=cm.getNetworkInfo(ConnectivityManager.TYPE_WIMAX);
  if (ni == null) {
    PreferenceScreen root=getPreferenceScreen();
    Preference ps=(Preference)findPreference(KEY_WIMAX_MAC_ADDRESS);
    if (ps != null)     root.removePreference(ps);
  }
 else {
    Preference wimaxMacAddressPref=findPreference(KEY_WIMAX_MAC_ADDRESS);
    String macAddress=SystemProperties.get("net.wimax.mac.address",getString(R.string.status_unavailable));
    wimaxMacAddressPref.setSummary(macAddress);
  }
}
 

Example 4

From project android_packages_apps_cmparts, under directory /src/com/cyanogenmod/cmparts/activities/.

Source file: GestureMenuActivity.java

  22 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  addPreferencesFromResource(R.xml.gesture_settings);
  PreferenceScreen prefSet=getPreferenceScreen();
  mGesturesEnable=(CheckBoxPreference)prefSet.findPreference(LOCKSCREEN_GESTURES_ENABLE);
  mGesturesTrail=(CheckBoxPreference)prefSet.findPreference(LOCKSCREEN_GESTURES_TRAIL);
  mGesturesSensitivity=(ListPreference)prefSet.findPreference(LOCKSCREEN_GESTURES_SENSITIVITY);
  mGesturesColor=(Preference)prefSet.findPreference(LOCKSCREEN_GESTURES_COLOR);
  final PreferenceGroup parentPreference=getPreferenceScreen();
  parentPreference.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
  mGesturesColor.setSummary(Integer.toHexString(getGestureColor()));
}
 

Example 5

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: CameraSettings.java

  22 
vote

public PreferenceScreen getPreferenceScreen(int preferenceRes){
  PreferenceScreen screen=mManager.createPreferenceScreen(mContext);
  mManager.inflateFromResource(mContext,preferenceRes,screen);
  initPreference(screen);
  return screen;
}
 

Example 6

From project android_packages_apps_QuickSearchBox, under directory /src/com/android/quicksearchbox/.

Source file: SearchSettings.java

  22 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  getPreferenceManager().setSharedPreferencesName(PREFERENCES_NAME);
  addPreferencesFromResource(R.xml.preferences);
  PreferenceScreen preferenceScreen=getPreferenceScreen();
  mClearShortcutsPreference=preferenceScreen.findPreference(CLEAR_SHORTCUTS_PREF);
  mSearchEngineSettingsPreference=(PreferenceScreen)preferenceScreen.findPreference(SEARCH_ENGINE_SETTINGS_PREF);
  Preference corporaPreference=preferenceScreen.findPreference(SEARCH_CORPORA_PREF);
  corporaPreference.setIntent(getSearchableItemsIntent(this));
  mClearShortcutsPreference.setOnPreferenceClickListener(this);
  updateClearShortcutsPreference();
  populateSearchEnginePreference();
}
 

Example 7

From project android_packages_apps_SalvageParts, under directory /src/com/salvagemod/salvageparts/activities/.

Source file: UIPowerWidgetActivity.java

  22 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setTitle(R.string.title_expanded_widget);
  addPreferencesFromResource(R.xml.ui_power_widget_settings);
  PreferenceScreen prefSet=getPreferenceScreen();
  mPowerWidget=(CheckBoxPreference)prefSet.findPreference(UI_EXP_WIDGET);
  mPowerWidgetHideOnChange=(CheckBoxPreference)prefSet.findPreference(UI_EXP_WIDGET_HIDE_ONCHANGE);
  mPowerWidgetColor=prefSet.findPreference(UI_EXP_WIDGET_COLOR);
  mPowerPicker=(PreferenceScreen)prefSet.findPreference(UI_EXP_WIDGET_PICKER);
  mPowerOrder=(PreferenceScreen)prefSet.findPreference(UI_EXP_WIDGET_ORDER);
  mPowerWidget.setChecked((Settings.System.getInt(getContentResolver(),Settings.System.EXPANDED_VIEW_WIDGET,1) == 1));
  mPowerWidgetHideOnChange.setChecked((Settings.System.getInt(getContentResolver(),Settings.System.EXPANDED_HIDE_ONCHANGE,0) == 1));
}
 

Example 8

From project COSsettings, under directory /src/com/cyanogenmod/cmparts/activities/.

Source file: GestureMenuActivity.java

  22 
vote

@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  addPreferencesFromResource(R.xml.gesture_settings);
  PreferenceScreen prefSet=getPreferenceScreen();
  mGesturesEnable=(CheckBoxPreference)prefSet.findPreference(LOCKSCREEN_GESTURES_ENABLE);
  mGesturesTrail=(CheckBoxPreference)prefSet.findPreference(LOCKSCREEN_GESTURES_TRAIL);
  mGesturesSensitivity=(ListPreference)prefSet.findPreference(LOCKSCREEN_GESTURES_SENSITIVITY);
  mGesturesColor=(Preference)prefSet.findPreference(LOCKSCREEN_GESTURES_COLOR);
  final PreferenceGroup parentPreference=getPreferenceScreen();
  parentPreference.getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
  mGesturesColor.setSummary(Integer.toHexString(getGestureColor()));
}
 

Example 9

From project creamed_glacier_app_settings, under directory /src/com/android/settings/accounts/.

Source file: AccountSyncSettings.java

  22 
vote

/** 
 * Updates the titlebar with an icon for the provider type.
 */
@Override protected void onAuthDescriptionsUpdated(){
  super.onAuthDescriptionsUpdated();
  getPreferenceScreen().removeAll();
  if (mAccount != null) {
    mProviderIcon.setImageDrawable(getDrawableForType(mAccount.type));
    mProviderId.setText(getLabelForType(mAccount.type));
    PreferenceScreen prefs=addPreferencesForType(mAccount.type);
    if (prefs != null) {
      updatePreferenceIntents(prefs);
    }
  }
  addPreferencesFromResource(R.xml.account_sync_settings);
}
 

Example 10

From project androidpn, under directory /androidpn-client/src/org/androidpn/client/.

Source file: NotificationSettingsActivity.java

  21 
vote

private PreferenceScreen createPreferenceHierarchy(){
  Log.d(LOGTAG,"createSettingsPreferenceScreen()...");
  PreferenceManager preferenceManager=getPreferenceManager();
  preferenceManager.setSharedPreferencesName(Constants.SHARED_PREFERENCE_NAME);
  preferenceManager.setSharedPreferencesMode(Context.MODE_PRIVATE);
  PreferenceScreen root=preferenceManager.createPreferenceScreen(this);
  CheckBoxPreference notifyPref=new CheckBoxPreference(this);
  notifyPref.setKey(Constants.SETTINGS_NOTIFICATION_ENABLED);
  notifyPref.setTitle("Notifications Enabled");
  notifyPref.setSummaryOn("Receive push messages");
  notifyPref.setSummaryOff("Do not receive push messages");
  notifyPref.setDefaultValue(Boolean.TRUE);
  notifyPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    public boolean onPreferenceChange(    Preference preference,    Object newValue){
      boolean checked=Boolean.valueOf(newValue.toString());
      if (checked) {
        preference.setTitle("Notifications Enabled");
      }
 else {
        preference.setTitle("Notifications Disabled");
      }
      return true;
    }
  }
);
  CheckBoxPreference soundPref=new CheckBoxPreference(this);
  soundPref.setKey(Constants.SETTINGS_SOUND_ENABLED);
  soundPref.setTitle("Sound");
  soundPref.setSummary("Play a sound for notifications");
  soundPref.setDefaultValue(Boolean.TRUE);
  CheckBoxPreference vibratePref=new CheckBoxPreference(this);
  vibratePref.setKey(Constants.SETTINGS_VIBRATE_ENABLED);
  vibratePref.setTitle("Vibrate");
  vibratePref.setSummary("Vibrate the phone for notifications");
  vibratePref.setDefaultValue(Boolean.TRUE);
  root.addPreference(notifyPref);
  root.addPreference(soundPref);
  root.addPreference(vibratePref);
  return root;
}
 

Example 11

From project android_packages_apps_CMSettings, under directory /src/com/cyanogenmod/settings/activities/.

Source file: Backlight.java

  21 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.backlight_settings);
  PreferenceScreen prefSet=getPreferenceScreen();
  ContentResolver cr=getContentResolver();
  mFilterEnabled=(CheckBoxPreference)prefSet.findPreference(FILTER_ENABLED);
  mFilterEnabled.setChecked(Settings.System.getInt(cr,Settings.System.LIGHT_FILTER,0) != 0);
  mFilterEnabled.setOnPreferenceChangeListener(this);
  mFilterReset=(ListPreference)prefSet.findPreference(FILTER_RESET);
  mFilterReset.setValue(String.valueOf(Settings.System.getInt(cr,Settings.System.LIGHT_FILTER_RESET,-1)));
  mFilterReset.setOnPreferenceChangeListener(this);
  mFilterWindow=(ListPreference)prefSet.findPreference(FILTER_WINDOW);
  mFilterWindow.setValue(String.valueOf(Settings.System.getInt(cr,Settings.System.LIGHT_FILTER_WINDOW,30000)));
  mFilterWindow.setOnPreferenceChangeListener(this);
  mFilterInterval=(ListPreference)prefSet.findPreference(FILTER_INTERVAL);
  mFilterInterval.setValue(String.valueOf(Settings.System.getInt(cr,Settings.System.LIGHT_FILTER_INTERVAL,1000)));
  mFilterInterval.setOnPreferenceChangeListener(this);
  mLevelsEnabled=(CheckBoxPreference)prefSet.findPreference(LEVELS_ENABLED);
  mLevelsEnabled.setChecked(Settings.System.getInt(cr,Settings.System.LIGHT_SENSOR_CUSTOM,0) != 0);
  mLevelsEnabled.setOnPreferenceChangeListener(this);
  mScreenDim=(ListPreference)prefSet.findPreference(SCREEN_DIM);
  mScreenDim.setValue(String.valueOf(Settings.System.getInt(cr,Settings.System.LIGHT_SCREEN_DIM,android.os.Power.BRIGHTNESS_DIM)));
  mScreenDim.setOnPreferenceChangeListener(this);
  mDecreaseEnabled=(CheckBoxPreference)prefSet.findPreference(DECREASE_ENABLED);
  mDecreaseEnabled.setChecked(Settings.System.getInt(cr,Settings.System.LIGHT_DECREASE,0) != 0);
  mDecreaseEnabled.setOnPreferenceChangeListener(this);
  mDecreaseHysteresis=(ListPreference)prefSet.findPreference(DECREASE_HYSTERESIS);
  mDecreaseHysteresis.setValue(String.valueOf(Settings.System.getInt(cr,Settings.System.LIGHT_HYSTERESIS,50)));
  mDecreaseHysteresis.setOnPreferenceChangeListener(this);
}
 

Example 12

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: CallFeaturesSetting.java

  21 
vote

@Override protected void onResume(){
  super.onResume();
  mForeground=true;
  if (isAirplaneModeOn()) {
    Preference sipSettings=findPreference(SIP_SETTINGS_CATEGORY_KEY);
    PreferenceScreen screen=getPreferenceScreen();
    int count=screen.getPreferenceCount();
    for (int i=0; i < count; ++i) {
      Preference pref=screen.getPreference(i);
      if (pref != sipSettings)       pref.setEnabled(false);
    }
    return;
  }
  if (mButtonNotifications != null) {
    boolean notification=mButtonNotifications.getSharedPreferences().getBoolean(BUTTON_VOICEMAIL_NOTIFICATION_KEY,true);
    mButtonNotifications.setChecked(notification);
  }
  if (mButtonDTMF != null) {
    int dtmf=Settings.System.getInt(getContentResolver(),Settings.System.DTMF_TONE_TYPE_WHEN_DIALING,DTMF_TONE_TYPE_NORMAL);
    mButtonDTMF.setValueIndex(dtmf);
  }
  if (mButtonAutoRetry != null) {
    int autoretry=Settings.System.getInt(getContentResolver(),Settings.System.CALL_AUTO_RETRY,0);
    mButtonAutoRetry.setChecked(autoretry != 0);
  }
  if (mButtonHAC != null) {
    int hac=Settings.System.getInt(getContentResolver(),Settings.System.HEARING_AID,0);
    mButtonHAC.setChecked(hac != 0);
  }
  if (mButtonTTY != null) {
    int settingsTtyMode=Settings.Secure.getInt(getContentResolver(),Settings.Secure.PREFERRED_TTY_MODE,Phone.TTY_MODE_OFF);
    mButtonTTY.setValue(Integer.toString(settingsTtyMode));
    updatePreferredTtyModeSummary(settingsTtyMode);
  }
}
 

Example 13

From project apjp, under directory /APJP_LOCAL_JAVA_ANDROID/src/main/java/APJP/ANDROID/.

Source file: MainUI2.java

  21 
vote

protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  addPreferencesFromResource(R.xml.preferences);
  PreferenceScreen preferenceScreen=getPreferenceScreen();
  SharedPreferences sharedPreferences=preferenceScreen.getSharedPreferences();
  sharedPreferences.registerOnSharedPreferenceChangeListener(this);
  onSharedPreferenceChanged(sharedPreferences,"APJP_KEY");
  onSharedPreferenceChanged(sharedPreferences,"APJP_LOCAL_PROXY_SERVER_ADDRESS");
  onSharedPreferenceChanged(sharedPreferences,"APJP_LOCAL_PROXY_SERVER_PORT");
  onSharedPreferenceChanged(sharedPreferences,"APJP_LOCAL_HTTP_PROXY_SERVER_ADDRESS");
  onSharedPreferenceChanged(sharedPreferences,"APJP_LOCAL_HTTP_PROXY_SERVER_PORT");
  onSharedPreferenceChanged(sharedPreferences,"APJP_LOCAL_HTTP_SERVER_ADDRESS");
  onSharedPreferenceChanged(sharedPreferences,"APJP_LOCAL_HTTP_SERVER_PORT");
  for (int i=0; i < 10; i=i + 1) {
    onSharedPreferenceChanged(sharedPreferences,"APJP_REMOTE_HTTP_SERVER_" + (i + 1) + "_REQUEST_URL");
    for (int j=0; j < 5; j=j + 1) {
      onSharedPreferenceChanged(sharedPreferences,"APJP_REMOTE_HTTP_SERVER_" + (i + 1) + "_REQUEST_PROPERTY_"+ (j + 1)+ "_KEY");
      onSharedPreferenceChanged(sharedPreferences,"APJP_REMOTE_HTTP_SERVER_" + (i + 1) + "_REQUEST_PROPERTY_"+ (j + 1)+ "_VALUE");
    }
  }
  onSharedPreferenceChanged(sharedPreferences,"APJP_LOCAL_HTTPS_PROXY_SERVER_ADDRESS");
  onSharedPreferenceChanged(sharedPreferences,"APJP_LOCAL_HTTPS_PROXY_SERVER_PORT");
  onSharedPreferenceChanged(sharedPreferences,"APJP_LOCAL_HTTPS_SERVER_ADDRESS");
  onSharedPreferenceChanged(sharedPreferences,"APJP_LOCAL_HTTPS_SERVER_PORT");
  for (int i=0; i < 10; i=i + 1) {
    onSharedPreferenceChanged(sharedPreferences,"APJP_REMOTE_HTTPS_SERVER_" + (i + 1) + "_REQUEST_URL");
    for (int j=0; j < 5; j=j + 1) {
      onSharedPreferenceChanged(sharedPreferences,"APJP_REMOTE_HTTPS_SERVER_" + (i + 1) + "_REQUEST_PROPERTY_"+ (j + 1)+ "_KEY");
      onSharedPreferenceChanged(sharedPreferences,"APJP_REMOTE_HTTPS_SERVER_" + (i + 1) + "_REQUEST_PROPERTY_"+ (j + 1)+ "_VALUE");
    }
  }
  onSharedPreferenceChanged(sharedPreferences,"APJP_HTTP_PROXY_SERVER_ADDRESS");
  onSharedPreferenceChanged(sharedPreferences,"APJP_HTTP_PROXY_SERVER_PORT");
  onSharedPreferenceChanged(sharedPreferences,"APJP_HTTP_PROXY_SERVER_USERNAME");
  onSharedPreferenceChanged(sharedPreferences,"APJP_HTTP_PROXY_SERVER_PASSWORD");
  onSharedPreferenceChanged(sharedPreferences,"APJP_HTTPS_PROXY_SERVER_ADDRESS");
  onSharedPreferenceChanged(sharedPreferences,"APJP_HTTPS_PROXY_SERVER_PORT");
  onSharedPreferenceChanged(sharedPreferences,"APJP_HTTPS_PROXY_SERVER_USERNAME");
  onSharedPreferenceChanged(sharedPreferences,"APJP_HTTPS_PROXY_SERVER_PASSWORD");
}
 

Example 14

From project callmeter, under directory /src/de/ub0r/android/callmeter/ui/prefs/.

Source file: HourGroupEdit.java

  21 
vote

/** 
 * Reload numbers.
 */
@SuppressWarnings("deprecation") private void reload(){
  Cursor c=this.getContentResolver().query(ContentUris.withAppendedId(DataProvider.HoursGroup.CONTENT_URI,this.gid),DataProvider.HoursGroup.PROJECTION,null,null,null);
  if (c.moveToFirst()) {
    this.getSupportActionBar().setSubtitle(c.getString(DataProvider.HoursGroup.INDEX_NAME));
  }
  c.close();
  PreferenceScreen ps=(PreferenceScreen)this.findPreference("container");
  ps.removeAll();
  c=this.getContentResolver().query(ContentUris.withAppendedId(DataProvider.Hours.GROUP_URI,this.gid),DataProvider.Hours.PROJECTION,null,null,DataProvider.Hours.DAY + ", " + DataProvider.Hours.HOUR);
  if (c.moveToFirst()) {
    do {
      Preference p=new Preference(this);
      p.setPersistent(false);
      final int day=c.getInt(DataProvider.Hours.INDEX_DAY);
      final int hour=c.getInt(DataProvider.Hours.INDEX_HOUR);
      p.setTitle(this.resDays[day] + ": " + this.resHours[hour]);
      p.setKey("item_" + c.getInt(DataProvider.Hours.INDEX_ID));
      p.setOnPreferenceClickListener(this);
      ps.addPreference(p);
    }
 while (c.moveToNext());
  }
  c.close();
}
 

Example 15

From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/.

Source file: SettingsActivity.java

  19 
vote

@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  if (preference.getKey().equals(ACCOUNT_KEY)) {
    signInOrOut();
    return true;
  }
 else   if (preference.getKey().equals(EXTERNAL_SENSOR_KEY)) {
    startActivity(new Intent(this,ExternalSensorActivity.class));
    return true;
  }
 else   if (preference.getKey().equals(MEASUREMENT_STREAMS_KEY)) {
    Intents.startStreamsActivity(this);
    return true;
  }
 else   if (preference.getKey().equals(BACKEND_SETTINGS_KEY)) {
    startActivity(new Intent(this,BackendSettingsActivity.class));
    return true;
  }
 else {
    return super.onPreferenceTreeClick(preferenceScreen,preference);
  }
}
 

Example 16

From project android-thaiime, under directory /inputmethodcommon/src/com/android/inputmethodcommon/.

Source file: InputMethodSettingsImpl.java

  19 
vote

/** 
 * Initialize internal states of this object.
 * @param context the context for this application.
 * @param prefScreen a PreferenceScreen of PreferenceActivity or PreferenceFragment.
 * @return true if this application is an IME and has two or more subtypes, false otherwise.
 */
public boolean init(final Context context,final PreferenceScreen prefScreen){
  mContext=context;
  mImm=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
  mImi=getMyImi(context,mImm);
  if (mImi == null || mImi.getSubtypeCount() <= 1) {
    return false;
  }
  mSubtypeEnablerPreference=new Preference(context);
  mSubtypeEnablerPreference.setOnPreferenceClickListener(new OnPreferenceClickListener(){
    @Override public boolean onPreferenceClick(    Preference preference){
      final CharSequence title=getSubtypeEnablerTitle(context);
      final Intent intent=new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
      intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID,mImi.getId());
      if (!TextUtils.isEmpty(title)) {
        intent.putExtra(Intent.EXTRA_TITLE,title);
      }
      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP);
      context.startActivity(intent);
      return true;
    }
  }
);
  prefScreen.addPreference(mSubtypeEnablerPreference);
  updateSubtypeEnabler();
  return true;
}
 

Example 17

From project android_device_samsung_galaxys2, under directory /DeviceSettings/src/com/cyanogenmod/settings/device/.

Source file: RadioFragmentActivity.java

  19 
vote

@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  String boxValue;
  String key=preference.getKey();
  Log.w(TAG,"key: " + key);
  return true;
}
 

Example 18

From project android_device_samsung_galaxys2_1, under directory /DeviceSettings/src/com/cyanogenmod/settings/device/.

Source file: RadioFragmentActivity.java

  19 
vote

@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  String boxValue;
  String key=preference.getKey();
  Log.w(TAG,"key: " + key);
  return true;
}
 

Example 19

From project android_device_samsung_i777, under directory /DeviceSettings/src/com/cyanogenmod/settings/device/.

Source file: RadioFragmentActivity.java

  19 
vote

@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  String boxValue;
  String key=preference.getKey();
  Log.w(TAG,"key: " + key);
  return true;
}
 

Example 20

From project andstatus, under directory /src/org/andstatus/app/account/.

Source file: AccountSettings.java

  19 
vote

@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  MyLog.d(TAG,"Preference clicked:" + preference.toString());
  if (preference.getKey().compareTo(MyPreferences.KEY_VERIFY_CREDENTIALS) == 0) {
    verifyCredentials(true);
  }
  return super.onPreferenceTreeClick(preferenceScreen,preference);
}
 

Example 21

From project andtweet, under directory /src/com/xorcode/andtweet/.

Source file: PreferencesActivity.java

  19 
vote

@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,Preference preference){
  AndTweetService.d(TAG,"Preference clicked:" + preference.toString());
  if (preference.getKey().compareTo(KEY_VERIFY_CREDENTIALS) == 0) {
    verifyCredentials(true);
  }
  return super.onPreferenceTreeClick(preferenceScreen,preference);
}
 

Example 22

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/ui/.

Source file: AboutActivity.java

  19 
vote

@Override public boolean onPreferenceTreeClick(final PreferenceScreen preferenceScreen,final Preference preference){
  final String key=preference.getKey();
  if (KEY_ABOUT_LICENSE.equals(key)) {
    startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(Constants.LICENSE_URL)));
    finish();
  }
 else   if (KEY_ABOUT_SOURCE.equals(key)) {
    startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(Constants.SOURCE_URL)));
    finish();
  }
 else   if (KEY_ABOUT_CREDITS_BITCOINJ.equals(key)) {
    startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(Constants.CREDITS_BITCOINJ_URL)));
    finish();
  }
 else   if (KEY_ABOUT_CREDITS_ZXING.equals(key)) {
    startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(Constants.CREDITS_ZXING_URL)));
    finish();
  }
 else   if (KEY_ABOUT_CREDITS_ICON.equals(key)) {
    startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(Constants.CREDITS_ICON_URL)));
    finish();
  }
 else   if (KEY_ABOUT_AUTHOR_TWITTER.equals(key)) {
    startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(Constants.AUTHOR_TWITTER_URL)));
    finish();
  }
 else   if (KEY_ABOUT_AUTHOR_GOOGLEPLUS.equals(key)) {
    startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(Constants.AUTHOR_GOOGLEPLUS_URL)));
    finish();
  }
 else   if (KEY_ABOUT_MARKET_APP.equals(key)) {
    startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(String.format(Constants.MARKET_APP_URL,getPackageName()))));
    finish();
  }
 else   if (KEY_ABOUT_MARKET_PUBLISHER.equals(key)) {
    startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse(Constants.MARKET_PUBLISHER_URL)));
    finish();
  }
  return false;
}