@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Intent.ACTION_BATTERY_CHANGED.equals(action)) { mBatteryLevel.setSummary(Utils.getBatteryPercentage(intent)); mBatteryStatus.setSummary(Utils.getBatteryStatus(getResources(), intent)); } else if (SPN_STRINGS_UPDATED_ACTION.equals(action)) { String operatorName = null; String plmn = null; String spn = null; if (intent.getBooleanExtra(EXTRA_SHOW_PLMN, false)) { plmn = intent.getStringExtra(EXTRA_PLMN); if (plmn != null) { operatorName = plmn; } } if (intent.getBooleanExtra(EXTRA_SHOW_SPN, false)) { spn = intent.getStringExtra(EXTRA_SPN); if (spn != null) { operatorName = spn; } } Preference p = findPreference(KEY_OPERATOR_NAME); if (p != null) { mExt.updateOpNameFromRec(p, operatorName); } } }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mSharedPreferences = getPreferenceManager().getSharedPreferences(); mSharedPreferences.registerOnSharedPreferenceChangeListener(this); // No value exists for the url key, we set the default values if (StringUtils.isEmpty( mSharedPreferences.getString(getString(R.string.preference_key_key_base_url), ""))) { // View Preference prefKeyBackendUrl = findPreference(getString(R.string.preference_key_key_base_url)); prefKeyBackendUrl.setSummary(getResources().getStringArray(R.array.backend_url_keys)[0]); Preference prefValueBackendUrl = findPreference(getString(R.string.preference_key_value_base_url)); prefValueBackendUrl.setSummary(getResources().getStringArray(R.array.backend_url_values)[0]); // Shared settings values SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putString( getString(R.string.preference_key_key_base_url), getResources().getStringArray(R.array.backend_url_keys)[0]); editor.putString( getString(R.string.preference_key_value_base_url), getResources().getStringArray(R.array.backend_url_values)[0]); editor.commit(); } }
private void updateDebuggerOptions() { mDebugApp = Settings.Global.getString(getActivity().getContentResolver(), Settings.Global.DEBUG_APP); updateCheckBox( mWaitForDebugger, Settings.Global.getInt( getActivity().getContentResolver(), Settings.Global.WAIT_FOR_DEBUGGER, 0) != 0); if (mDebugApp != null && mDebugApp.length() > 0) { String label; try { ApplicationInfo ai = getActivity() .getPackageManager() .getApplicationInfo(mDebugApp, PackageManager.GET_DISABLED_COMPONENTS); CharSequence lab = getActivity().getPackageManager().getApplicationLabel(ai); label = lab != null ? lab.toString() : mDebugApp; } catch (PackageManager.NameNotFoundException e) { label = mDebugApp; } mDebugAppPref.setSummary(getResources().getString(R.string.debug_app_set, label)); mWaitForDebugger.setEnabled(true); mHaveDebugSettings = true; } else { mDebugAppPref.setSummary(getResources().getString(R.string.debug_app_not_set)); mWaitForDebugger.setEnabled(false); } }
/* * Update the summary of a setting to reflect its current value. */ private void updatePreferenceSummary(SharedPreferences sharedPrefs, String key) { Log.d(TAG, key + " changed. Updating summary"); Preference p = findPreference(key); if (p instanceof EditTextPreference) { p.setSummary(sharedPrefs.getString(key, "")); if (key.equals("prefRunningSpeed")) { ActivityMain.runningSpeed = Integer.valueOf(sharedPrefs.getString(key, "")); } else if (key.equals("prefEscapeTimeout")) { ActivityMain.mEscapeTimeoutSec = Integer.valueOf(sharedPrefs.getString(key, "")); } } if (key.equals("prefAlarmTime")) { Long alarm = sharedPrefs.getLong("prefAlarmTime", 0); String alarmString; if (alarm == 0) { alarmString = "not set"; } else { Calendar newAlarm = Calendar.getInstance(); newAlarm.setTimeInMillis(alarm); alarmString = AlarmPicker.alarmTimeFormat.format(newAlarm.getTime()); } p.setSummary(alarmString); } }
void updateSignalStrength(SignalStrength signalStrength) { if (mSignalStrength != null) { int state = mPhone.getServiceState().getState(); Resources r = getResources(); if ((ServiceState.STATE_OUT_OF_SERVICE == state) || (ServiceState.STATE_POWER_OFF == state)) { mSignalStrength.setSummary("0"); return; } int signalDbm = signalStrength.getDbm(); if (-1 == signalDbm) signalDbm = 0; int signalAsu = signalStrength.getAsuLevel(); if (-1 == signalAsu) signalAsu = 0; mSignalStrength.setSummary( String.valueOf(signalDbm) + " " + r.getString(R.string.radioInfo_display_dbm) + " " + String.valueOf(signalAsu) + " " + r.getString(R.string.radioInfo_display_asu)); } }
private void updateUI() { Log.i(TAG, "mSimTracker is " + mSimTracker); if (mSimTracker.getInsertedSim().length == 0) { mPreference.setOnPreferenceClickListener(mNoSimListener); mPreference.setSummary(R.string.status_pending); } else { ControlData controlData = null; try { controlData = ControlData.buildControlData(mAgent.readControlData()); } catch (RemoteException e) { e.printStackTrace(); } if (controlData == null) { mPreference.setEnabled(false); return; } if (controlData.isEnabled()) { mPreference.setSummary(R.string.status_enabled); mPreference.setOnPreferenceClickListener(mEnabledListener); } else if (controlData.isProvisioned()) { mPreference.setSummary(R.string.status_provisioned); mPreference.setOnPreferenceClickListener(mProvisionedListener); } else { mPreference.setSummary(R.string.status_unprovisioned); mPreference.setOnPreferenceClickListener(mNotProvisionedListener); } } }
@Override public boolean onPreferenceChange(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { ListPreference listPreference = (ListPreference) preference; int index = listPreference.findIndexOfValue(stringValue); preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null); } else if (preference instanceof RingtonePreference) { if (TextUtils.isEmpty(stringValue)) { preference.setSummary(R.string.pref_ringtone_silent); } else { Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(stringValue)); if (ringtone == null) { preference.setSummary(null); } else { String name = ringtone.getTitle(preference.getContext()); preference.setSummary(name); } } } else { preference.setSummary(stringValue); } return true; }
@Override public boolean onPreferenceChange(Preference preference, Object newValue) { if (preference instanceof ListPreference && newValue instanceof String) { final ListPreference listPreference = (ListPreference) preference; final int index = listPreference.findIndexOfValue((String) newValue); final CharSequence[] entries = listPreference.getEntries(); if (index >= 0 && index < entries.length) { preference.setSummary(entries[index].toString().replaceAll("%", "%%")); } else { preference.setSummary(""); } } final String key = preference.getKey(); if (getString(R.string.pref_resume_talkback_key).equals(key)) { final String oldValue = SharedPreferencesUtils.getStringPref( mPrefs, getResources(), R.string.pref_resume_talkback_key, R.string.pref_resume_talkback_default); if (!newValue.equals(oldValue)) { // Reset the suspend warning dialog when the resume // preference changes. SharedPreferencesUtils.putBooleanPref( mPrefs, getResources(), R.string.pref_show_suspension_confirmation_dialog, true); } } return true; }
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); findPreference("about").setOnPreferenceClickListener(this); Preference account = findPreference("account"); account.setOnPreferenceClickListener(this); if (((MainActivity) getActivity()).getGC().isConnected()) { account.setSummary( getString( R.string.signed_in, ((MainActivity) getActivity()).getGC().getCurrentPlayer().getDisplayName())); } final SharedPreferences prefs = getPreferenceManager().getSharedPreferences(); Preference goal = findPreference("goal"); goal.setOnPreferenceClickListener(this); goal.setSummary(getString(R.string.goal_summary, prefs.getInt("goal", DEFAULT_GOAL))); Preference stepsize = findPreference("stepsize"); stepsize.setOnPreferenceClickListener(this); stepsize.setSummary( getString( R.string.step_size_summary, prefs.getFloat("stepsize_value", DEFAULT_STEP_SIZE), prefs.getString("stepsize_unit", DEFAULT_STEP_UNIT))); setHasOptionsMenu(true); }
@Override public boolean onPreferenceChange(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof RingtonePreference) { // For ringtone preferences, look up the correct display value // using RingtoneManager. Ringtone ringtone = RingtoneManager.getRingtone(preference.getContext(), Uri.parse(stringValue)); if (ringtone == null) { // Clear the summary if there was a lookup error. preference.setSummary(null); } else { // Set the summary to reflect the new ringtone display // name. String name = ringtone.getTitle(preference.getContext()); preference.setSummary(name); } } else { // For all other preferences, set the summary to the value's // simple string representation. preference.setSummary(stringValue); } return true; }
@Override public boolean onPreferenceChange(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list. ListPreference listPreference = (ListPreference) preference; int index = listPreference.findIndexOfValue(stringValue); // Set the summary to reflect the new value. preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null); } else if (preference instanceof CheckBoxPreference) { // Trigger the listener immediately with the preference's // current value. if (preference.getKey().equals("prefHumidityOnTop")) { preference.setSummary( Boolean.valueOf(stringValue) ? R.string.pref_on_top_humidity_summary_yes : R.string.pref_on_top_humidity_summary_no); } } else if (preference instanceof EditTextPreference) { } else { // For all other preferences, set the summary to the value's // simple string representation. preference.setSummary(stringValue); } return true; }
@Override protected void onResume() { super.onResume(); // check if the full screen mode should be activated if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("fullscreen", false)) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } else { getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } // sets the currently selected filename if available Preference source = findPreference("mapsforge_background_type"); final String filePath = PreferenceManager.getDefaultSharedPreferences(getBaseContext()) .getString(MapView.MAPSFORGE_BACKGROUND_FILEPATH, null); if (filePath != null) { if (filePath.contains("/")) { source.setSummary(filePath.substring(filePath.lastIndexOf("/") + 1)); } else { source.setSummary(filePath); } } }
@Override public boolean onPreferenceChange(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof ListPreference) { ListPreference listPreference = (ListPreference) preference; int index = listPreference.findIndexOfValue(stringValue); preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null); } else { preference.setSummary(stringValue); } // detect errors if (preference.getKey().equals("sos_uri")) { try { URL url = new URL(value.toString()); if (!url.getProtocol().equals("http") && !url.getProtocol().equals("https")) throw new Exception("SOS URL must be HTTP or HTTPS"); } catch (Exception e) { AlertDialog.Builder dlgAlert = new AlertDialog.Builder(preference.getContext()); dlgAlert.setMessage("Invalid SOS URL"); dlgAlert.setTitle(e.getMessage()); dlgAlert.setPositiveButton("OK", null); dlgAlert.setCancelable(true); dlgAlert.create().show(); } } return true; }
@Override public boolean onPreferenceChange(Preference preference, Object value) { String stringValue = value.toString(); // are we starting the preference activity? if (!mBindingPreference) { if (preference.getKey().equals(getString(R.string.pref_location_key))) { FetchWeatherTask weatherTask = new FetchWeatherTask(this); String location = value.toString(); weatherTask.execute(location); } else { // notify code that weather may be impacted getContentResolver().notifyChange(WeatherContract.WeatherEntry.CONTENT_URI, null); } } if (preference instanceof ListPreference) { // For list preferences, look up the correct display value in // the preference's 'entries' list (since they have separate labels/values). ListPreference listPreference = (ListPreference) preference; int prefIndex = listPreference.findIndexOfValue(stringValue); if (prefIndex >= 0) { preference.setSummary(listPreference.getEntries()[prefIndex]); } } else { // For other preferences, set the summary to the value's simple string representation. preference.setSummary(stringValue); } return true; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = getActivity(); mPreferences = PreferenceManager.getDefaultSharedPreferences(context); mPreferences.registerOnSharedPreferenceChangeListener(this); addPreferencesFromResource(R.layout.tools); mResidualFiles = findPreference(RESIDUAL_FILES); mOptimDB = findPreference(PREF_OPTIM_DB); long mStartTime = mPreferences.getLong(RESIDUAL_FILES, 0); mResidualFiles.setSummary(""); if (mStartTime > 0) mResidualFiles.setSummary(DateUtils.getRelativeTimeSpanString(mStartTime)); mStartTime = mPreferences.getLong(PREF_OPTIM_DB, 0); mOptimDB.setSummary(""); if (mStartTime > 0) mOptimDB.setSummary(DateUtils.getRelativeTimeSpanString(mStartTime)); if (Helpers.binExist("dd").equals(NOT_FOUND) || NO_FLASH) { PreferenceCategory hideCat = (PreferenceCategory) findPreference("category_flash_img"); getPreferenceScreen().removePreference(hideCat); } if (Helpers.binExist("pm").equals(NOT_FOUND)) { PreferenceCategory hideCat = (PreferenceCategory) findPreference("category_freezer"); getPreferenceScreen().removePreference(hideCat); } setRetainInstance(true); setHasOptionsMenu(true); }
void updateSignalStrength() { // TODO PhoneStateIntentReceiver is deprecated and PhoneStateListener // should probably used instead. // not loaded in some versions of the code (e.g., zaku) if (mSignalStrength != null) { int state = mPhoneStateReceiver.getServiceState().getState(); Resources r = getResources(); if ((ServiceState.STATE_OUT_OF_SERVICE == state) || (ServiceState.STATE_POWER_OFF == state)) { mSignalStrength.setSummary("0"); } int signalDbm = mPhoneStateReceiver.getSignalStrengthDbm(); if (-1 == signalDbm) signalDbm = 0; int signalAsu = mPhoneStateReceiver.getSignalStrengthLevelAsu(); if (-1 == signalAsu) signalAsu = 0; mSignalStrength.setSummary( String.valueOf(signalDbm) + " " + r.getString(R.string.radioInfo_display_dbm) + " " + String.valueOf(signalAsu) + " " + r.getString(R.string.radioInfo_display_asu)); } }
@SuppressWarnings("deprecation") @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { android.preference.Preference pref = findPreference(key); if (key.equals(getString(R.string.key_brightness)) || key.equals(getString(R.string.key_brightness_manual_value))) { ListPreference listPref = (ListPreference) findPreference(getString(R.string.key_brightness)); if (listPref.getValue().equals(getString(R.string.value_brightness_manual))) { listPref.setSummary( listPref.getEntry() + " " + (int) (100.0f * BrightnessDialog.getBrighnessLevel(sharedPreferences, this)) + " " + getString(R.string.percents)); } else { listPref.setSummary(listPref.getEntry()); } } else if (pref != null) { if (pref instanceof ListPreference) { ListPreference listPref = (ListPreference) pref; listPref.setSummary(listPref.getEntry()); } else if (key.equals(getString(R.string.key_color))) { pref.setSummary(ColorDialog.getTextColorString(sharedPreferences, this)); } else if (key.equals(getString(R.string.key_background_color))) { pref.setSummary(ColorDialog.getBackgroundColorString(sharedPreferences, this)); } else if (key.equals(getString(R.string.key_city))) { pref.setSummary(CityDialog.getCityName(sharedPreferences, this)); } } }
// update the channel list ui by channel array private void updateChannelUIList() { MmsLog.d(LOG_TAG, "updateChannelUIList start"); mChannelListPreference.removeAll(); int length = mChannelArray.size(); for (int i = 0; i < length; i++) { Preference channel = new Preference(this); int keyId = mChannelArray.get(i).getKeyId(); String channelName = mChannelArray.get(i).getChannelName(); int channelId = mChannelArray.get(i).getChannelId(); boolean channelState = mChannelArray.get(i).getChannelState(); String title = channelName + "(" + String.valueOf(channelId) + ")"; channel.setTitle(title); final CellBroadcastChannel oldChannel = new CellBroadcastChannel(keyId, channelId, channelName, channelState); if (channelState) { channel.setSummary(R.string.enable); } else { channel.setSummary(R.string.disable); } channel.setOnPreferenceClickListener( new OnPreferenceClickListener() { public boolean onPreferenceClick(Preference arg0) { showEditChannelDialog(oldChannel); return false; } }); mChannelListPreference.addPreference(channel); } MmsLog.d(LOG_TAG, "updateChannelUIList end"); }
protected void updateSummaries() { // for all text preferences, set summary as current database value for (String key : mPref.mValues.keySet()) { Preference pref = this.findPreference(key); String value = null; if (pref == null) { continue; } else if (pref instanceof CheckBoxPreference) { continue; } else if (pref instanceof ListPreference) { ListPreference lp = (ListPreference) pref; value = lp.getEntry() != null ? lp.getEntry().toString() : ""; } else { value = this.mPref.getString(key, ""); } // update summary if (!mPref.mSummaries.containsKey(key)) { CharSequence s = pref.getSummary(); mPref.mSummaries.put(key, s != null ? pref.getSummary().toString() : null); } String summ = mPref.mSummaries.get(key); if (summ != null && summ.contains("XXX")) { pref.setSummary(summ.replace("XXX", value)); } else { pref.setSummary(value); } } }
@Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { // Changing the backend url selection (internal, external, etc.) if (StringUtils.equals(key, getString(R.string.preference_key_key_base_url)) || StringUtils.equals(key, getString(R.string.preference_key_value_base_url))) { String keyValue = sharedPreferences.getString(key, ""); Preference keyPreference = findPreference(key); String[] keysTab = getResources().getStringArray(R.array.backend_url_keys); String[] valuesTab = getResources().getStringArray(R.array.backend_url_values); boolean resetBackendEndConnectors = true; if (StringUtils.equals(key, getString(R.string.preference_key_key_base_url))) { int indexKey = ArrayUtils.indexOf(keysTab, keyValue); // Setting the description to the right key keyPreference.setSummary(keyValue); // For custom key don't empty the field if (indexKey < keysTab.length - 1) { // If something changed if (!StringUtils.equals( valuesTab[indexKey], mSharedPreferences.getString( getString(R.string.preference_key_value_base_url), ""))) { Preference prefValueBackendUrl = findPreference(getString(R.string.preference_key_value_base_url)); prefValueBackendUrl.setSummary(valuesTab[indexKey]); ((EditTextPreference) prefValueBackendUrl).setText(valuesTab[indexKey]); // Saving the value on the settings SharedPreferences.Editor editor = mSharedPreferences.edit(); editor.putString( getString(R.string.preference_key_value_base_url), valuesTab[indexKey]); editor.commit(); } else { resetBackendEndConnectors = false; } } } // Changing the backend url value else { // Updating the description (Or custom if no value found) Preference prefKeyBackendUrl = findPreference(getString(R.string.preference_key_key_base_url)); prefKeyBackendUrl.setSummary(keysTab[ArrayUtils.indexOf(valuesTab, keyValue)]); keyPreference.setSummary(keyValue); } // Update the url of the backend if (resetBackendEndConnectors) { B2BApplication.updateUrl( mSharedPreferences.getString(getString(R.string.preference_key_value_base_url), "")); } } }
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (Intent.ACTION_BATTERY_CHANGED.equals(action)) { mBatteryLevel.setSummary(Utils.getBatteryPercentage(intent)); mBatteryStatus.setSummary(Utils.getBatteryStatus(getResources(), intent)); } }
@Override public void onStart() { String nodeFormat = getActivity().getString(R.string.opt_nodeindex_desc); String userFormat = getActivity().getString(R.string.opt_userindex_desc); super.onStart(); userIndex.setSummary(String.format(userFormat, opzioni.getUserIndex())); nodeIndex.setSummary(String.format(nodeFormat, opzioni.getNodeIndex())); }
private void updateState(@StringRes int targetKey, String valueKey) { Preference pref = findPreference(targetKey); if (pref.getSharedPreferences().getBoolean(valueKey, false)) { pref.setSummary(getString(R.string.state_enabled)); } else { pref.setSummary(getString(R.string.state_disabled)); } }
@Override protected void onResume() { super.onResume(); // TODO Auto-generated method stub if (!PreyStatus.getInstance().isPreyConfigurationActivityResume()) { Intent intent = new Intent(getApplicationContext(), LoginActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("EXIT", true); try { startActivity(intent); } catch (Exception e) { } finish(); } try { if (PreyEmail.getEmail(getApplicationContext()) != null) { PreferenceCategory mCategory = (PreferenceCategory) findPreference("PREFS_CAT_PREFS"); Preference p2 = findPreference(PreyConfig.PREFS_SCHEDULED); mCategory.removePreference(p2); } } catch (Exception e) { } PreyConfig preyConfig = PreyConfig.getPreyConfig(getApplicationContext()); Preference p = findPreference("PREFS_ADMIN_DEVICE"); if (preyConfig.isFroyoOrAbove()) { if (FroyoSupport.getInstance(getApplicationContext()).isAdminActive()) { p.setTitle(R.string.preferences_admin_enabled_title); p.setSummary(R.string.preferences_admin_enabled_summary); } else { p.setTitle(R.string.preferences_admin_disabled_title); p.setSummary(R.string.preferences_admin_disabled_summary); } } else p.setEnabled(false); p = findPreference("PREFS_ABOUT"); p.setSummary("Version " + preyConfig.getPreyVersion() + " - Prey Inc."); Preference pGo = findPreference("PREFS_GOTO_WEB_CONTROL_PANEL"); pGo.setOnPreferenceClickListener( new Preference.OnPreferenceClickListener() { public boolean onPreferenceClick(Preference preference) { String url = PreyConfig.getPreyConfig(getApplicationContext()).getPreyPanelUrl(); PreyLogger.d("url control:" + url); Intent internetIntent = new Intent(Intent.ACTION_VIEW); internetIntent.setData(Uri.parse(url)); try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); } catch (Exception e) { } return false; } }); }
private void setIpAddressStatus() { Preference ipAddressPref = findPreference(KEY_IP_ADDRESS); String ipAddress = Utils.getDefaultIpAddresses(this); if (ipAddress != null) { ipAddressPref.setSummary(ipAddress); } else { ipAddressPref.setSummary(getString(R.string.status_unavailable)); } }
private void updateTrustedPeer(@Nonnull final String trustedPeer) { if (trustedPeer.isEmpty()) { trustedPeerPreference.setSummary(R.string.preferences_trusted_peer_summary); trustedPeerOnlyPreference.setEnabled(false); } else { trustedPeerPreference.setSummary(trustedPeer); trustedPeerOnlyPreference.setEnabled(true); } }
protected boolean booleanPreference( Preference preference, Object value, int key, int disabledString, int enabledString) { if (getString(key).equals(preference.getKey())) { if (value != null && !(Boolean) value) preference.setSummary(disabledString); else preference.setSummary(enabledString); return true; } return false; }
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Preference p = findPreference(key); if (p instanceof EditTextPreference) { p.setSummary(sharedPreferences.getString(key, (String) p.getSummary())); } else if (p instanceof ListPreference) { p.setSummary((String) ((ListPreference) p).getEntry()); } }
public void handleMessage(Message msg) { switch (msg.what) { case MSG_UPDATE_RINGTONE_SUMMARY: mRingtonePreference.setSummary((CharSequence) msg.obj); break; case MSG_UPDATE_NOTIFICATION_SUMMARY: mNotificationPreference.setSummary((CharSequence) msg.obj); break; } }
private void updatePrefSummary(Preference p, boolean updatevis) { if (p instanceof ListPreference) { ListPreference listPref = (ListPreference) p; p.setSummary(listPref.getEntry()); } else if (p instanceof EditTextPreference) { EditTextPreference editTextPref = (EditTextPreference) p; p.setSummary(editTextPref.getText()); } }