public boolean onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == mRequestCode) {

      if (data != null) {
        Uri uri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);

        if (callChangeListener(uri != null ? uri.toString() : "")) {
          onSaveRingtone(uri);
        }
      }

      return true;
    }

    return false;
  }
  @Override
  protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValueObj) {
    String defaultValue = (String) defaultValueObj;

    /*
     * This method is normally to make sure the internal state and UI
     * matches either the persisted value or the default value. Since we
     * don't show the current value in the UI (until the dialog is opened)
     * and we don't keep local state, if we are restoring the persisted
     * value we don't need to do anything.
     */
    if (restorePersistedValue) {
      return;
    }

    // If we are setting to the default value, we should persist it.
    if (!TextUtils.isEmpty(defaultValue)) {
      onSaveRingtone(Uri.parse(defaultValue));
    }
  }
Exemplo n.º 3
0
 @Override
 protected void onSaveRingtone(Uri ringtoneUri) {
   super.onSaveRingtone(ringtoneUri);
   setSummaryFromValue(ringtoneUri);
 }