Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to use onPreferenceTreeClick event.</p> <p>For example see <a href="http://www.javased.com/index.php?source_dir=platform_packages_apps_phone/src/com/android/phone/MobileNetworkSettings.java" rel="nofollow noreferrer">http://www.javased.com/index.php?source_dir=platform_packages_apps_phone/src/com/android/phone/MobileNetworkSettings.java</a></p> <pre><code> @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { /** TODO: Refactor and get rid of the if's using subclasses */ if (mGsmUmtsOptions != null &amp;&amp; mGsmUmtsOptions.preferenceTreeClick(preference) == true) { return true; } else if (mCdmaOptions != null &amp;&amp; mCdmaOptions.preferenceTreeClick(preference) == true) { if (Boolean.parseBoolean( SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) { mClickedPreference = preference; // In ECM mode launch ECM app dialog startActivityForResult( new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS, null), REQUEST_CODE_EXIT_ECM); } return true; } else if (preference == mButtonPreferredNetworkMode) { //displays the value taken from the Settings.System int settingsNetworkMode = android.provider.Settings.Secure.getInt(mPhone.getContext(). getContentResolver(), android.provider.Settings.Secure.PREFERRED_NETWORK_MODE, preferredNetworkMode); mButtonPreferredNetworkMode.setValue(Integer.toString(settingsNetworkMode)); return true; } else if (preference == mButtonDataRoam) { if (DBG) log("onPreferenceTreeClick: preference == mButtonDataRoam."); //normally called on the toggle click if (mButtonDataRoam.isChecked()) { // First confirm with a warning dialog about charges mOkClicked = false; new AlertDialog.Builder(this).setMessage( getResources().getString(R.string.roaming_warning)) .setTitle(android.R.string.dialog_alert_title) .setIconAttribute(android.R.attr.alertDialogIcon) .setPositiveButton(android.R.string.yes, this) .setNegativeButton(android.R.string.no, this) .show() .setOnDismissListener(this); } else { mPhone.setDataRoamingEnabled(false); } return true; } else if (preference == mButtonDataEnabled) { if (DBG) log("onPreferenceTreeClick: preference == mButtonDataEnabled."); ConnectivityManager cm = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); cm.setMobileDataEnabled(mButtonDataEnabled.isChecked()); return true; } else if (preference == mLteDataServicePref) { String tmpl = android.provider.Settings.Secure.getString(getContentResolver(), android.provider.Settings.Secure.SETUP_PREPAID_DATA_SERVICE_URL); if (!TextUtils.isEmpty(tmpl)) { TelephonyManager tm = (TelephonyManager) getSystemService( Context.TELEPHONY_SERVICE); String imsi = tm.getSubscriberId(); if (imsi == null) { imsi = ""; } final String url = TextUtils.isEmpty(tmpl) ? null : TextUtils.expandTemplate(tmpl, imsi).toString(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); startActivity(intent); } else { android.util.Log.e(LOG_TAG, "Missing SETUP_PREPAID_DATA_SERVICE_URL"); } return true; } else { // if the button is anything but the simple toggle preference, // we'll need to disable all preferences to reject all click // events until the sub-activity's UI comes up. preferenceScreen.setEnabled(false); // Let the intents be launched by the Preference manager return false; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload