Java Code Examples for android.media.RingtoneManager#ACTION_RINGTONE_PICKER

The following examples show how to use android.media.RingtoneManager#ACTION_RINGTONE_PICKER . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AlarmClockActivity.java    From SuntimesWidget with GNU General Public License v3.0 6 votes vote down vote up
protected void ringtonePicker(@NonNull AlarmClockItem item)
{
    int ringtoneType = RingtoneManager.TYPE_RINGTONE;
    if (!AlarmSettings.loadPrefAllRingtones(this)) {
        ringtoneType = (item.type == AlarmClockItem.AlarmType.NOTIFICATION ? RingtoneManager.TYPE_NOTIFICATION : RingtoneManager.TYPE_ALARM);
    }

    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, ringtoneType);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, item.type.getDisplayString());
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, AlarmSettings.getDefaultRingtoneUri(this, item.type));
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (item.ringtoneURI != null ? Uri.parse(item.ringtoneURI) : null));
    t_selectedItem = item.rowID;
    startActivityForResult(intent, REQUEST_RINGTONE);
}
 
Example 2
Source File: SoundTonePreference.java    From notification-channel-compat with Apache License 2.0 6 votes vote down vote up
@Override
protected void onClick() {
    super.onClick();
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select Sound");
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, Settings.System.DEFAULT_NOTIFICATION_URI);

    String existingValue = getValue();
    if (existingValue != null) {
        if (existingValue.length() == 0) {
            // Select "Silent"
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) null);
        } else {
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(existingValue));
        }
    } else {
        // No ringtone has been selected, set to the default
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Settings.System.DEFAULT_NOTIFICATION_URI);
    }
    mParent.startActivityForResult(intent, REQUEST_CODE_ALERT_RINGTONE);
}
 
Example 3
Source File: ProfileActivity.java    From deltachat-android with GNU General Public License v3.0 6 votes vote down vote up
public void onSoundSettings() {
  Uri current = Prefs.getChatRingtone(this, chatId);
  Uri defaultUri = Prefs.getNotificationRingtone(this);

  if      (current == null)              current = Settings.System.DEFAULT_NOTIFICATION_URI;
  else if (current.toString().isEmpty()) current = null;

  Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, defaultUri);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, current);

  startActivityForResult(intent, REQUEST_CODE_PICK_RINGTONE);
}
 
Example 4
Source File: RingtoneSetting.java    From revolution-irc with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onClick(View v) {
    RingtoneSetting entry = getEntry();
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, entry.mValue);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI,
            RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, entry.mName);
    intent.putExtra("android.intent.extra.ringtone.AUDIO_ATTRIBUTES_FLAGS", 0x1 << 6); // Perhaps a bit of a hack, but imo needed
    mAdapter.startActivityForResult(intent, entry.mRequestCode);
}
 
Example 5
Source File: DashboardActivity.java    From itracing2 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onRingStone(int source) {
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_RINGTONE);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getString(R.string.ring_tone));
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(Preferences.getRingtone(this, address, Preferences.Source.values()[source].name())));
    startActivityForResult(intent, source);
}
 
Example 6
Source File: RingtonePreference.java    From MaterialPreference with Apache License 2.0 5 votes vote down vote up
@Override
protected void onClick() {
    // Launch the ringtone picker
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    onPrepareRingtonePickerIntent(intent);
    PreferenceFragment owningFragment = getPreferenceManager().getFragment();
    if (owningFragment != null) {
        owningFragment.startActivityForResult(intent, mRequestCode);
    }/* else {
        getPreferenceManager().getActivity().startActivityForResult(intent, mRequestCode);
    }*/
}
 
Example 7
Source File: MainActivity.java    From WechatUnrecalled with GNU General Public License v3.0 5 votes vote down vote up
private void requestRingtone(String tag) {
    if (!mSettingsHelper.getBoolean(tag + "_ringtone_enable", false))
        return;

    int request_code = -1;
    switch (tag) {
        case "custom":
            request_code = REQUEST_TONE_PICKER_CUSTOM;
            break;
        case "new_comment":
            request_code = REQUEST_TONE_PICKER_NEW_COMMENT;
            break;
        case "msg_recall":
            request_code = REQUEST_TONE_PICKER_MSG_RECALL;
            break;
        case "comment_recall":
            request_code = REQUEST_TONE_PICKER_COMMENT_RECALL;
    }

    if (request_code == -1)
        return;

    String uri = mSettingsHelper.getString(tag + "_ringtone", "");
    final Uri currentTone = TextUtils.isEmpty(uri) ? RingtoneManager
            .getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_NOTIFICATION) :
            Uri.parse(uri);
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getString(R.string.ringtone_selection));
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, currentTone);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
    startActivityForResult(intent, request_code);
}
 
Example 8
Source File: LedSettingsFragment.java    From GravityBox with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onPreferenceTreeClick(PreferenceScreen prefScreen, Preference pref) {
    if (pref == mNotifSoundPref) {
        Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, mSoundUri);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, 
                Settings.System.DEFAULT_NOTIFICATION_URI);
        startActivityForResult(intent, REQ_PICK_SOUND);
        return true;
    }
    return super.onPreferenceTreeClick(prefScreen, pref);
}
 
Example 9
Source File: CustomNotificationsDialogFragment.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
private void launchSoundSelector(@Nullable Uri current) {
  Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);

  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, Settings.System.DEFAULT_NOTIFICATION_URI);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, current);

  startActivityForResult(intent, RINGTONE_PICKER_REQUEST_CODE);
}
 
Example 10
Source File: SettingsFragment.java    From BlackList with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(View view) {
    if (isAdded()) {
        if (adapter.isRowChecked(view)) {
            // open ringtone picker dialog
            Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getString(R.string.Ringtone_picker));
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, getRingtoneUri(requestCode));
            startActivityForResult(intent, requestCode);
        }
    } else {
        adapter.setRowChecked(view, false);
    }
}
 
Example 11
Source File: AlarmsFragment.java    From sleep-cycle-alarm with GNU General Public License v3.0 5 votes vote down vote up
private void startRingtonePickerActivityForResult() {
    Uri selectedRingtoneUri = Uri.parse(dialogContract.getRingtone());
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE,
            getString(R.string.pref_ringtone_select_title));
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, selectedRingtoneUri);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI, selectedRingtoneUri);
    startActivityForResult(intent, RINGTONE_INTENT_REQUEST_CODE);
}
 
Example 12
Source File: PreferencesActivity.java    From 4pdaClient-plus with Apache License 2.0 5 votes vote down vote up
private void pickRingtone(int requestCode, Uri defaultSound) {
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, App.getContext().getString(R.string.pick_audio));
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, defaultSound);
    if (getActivity() != null)
        getActivity().startActivityForResult(intent, requestCode);
}
 
Example 13
Source File: SettingsNotification.java    From OmniList with GNU Affero General Public License v3.0 5 votes vote down vote up
private void showRingtonePicker() {
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, onRestoreRingtone());
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, onRestoreRingtone());
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALL);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getString(R.string.pick_notification_ringtone));
    this.startActivityForResult(intent, RINGTONE_REQUEST_CODE);
}
 
Example 14
Source File: ActivitySettings.java    From EasySettings with Apache License 2.0 5 votes vote down vote up
@Subscribe
public void onBasicSettingsClicked(BasicSettingsClickEvent event)
{
	if(event.getClickedSettingsObj()
			.getKey()
			.equals(ActivityMain.SETTINGS_KEY_RINGTONE))
	{
		String uriAsString = EasySettings.retrieveSettingsSharedPrefs(this)
										 .getString(ActivityMain.SETTINGS_KEY_RINGTONE,
													SETTINGS_RINGTONE_SILENT_VALUE);

		Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
		intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true)
			  .putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, false)
			  .putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION)
			  .putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "");

		if(uriAsString.equals(SETTINGS_RINGTONE_SILENT_VALUE))
		{
			intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, 0);
		}

		else
		{
			intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,
							Uri.parse(uriAsString));
		}

		startActivityForResult(intent, REQUEST_CODE_NOTIFICATION_PICKER);
	}

	else
	{
		makeToast(event.getClickedSettingsObj().getTitle());
	}
}
 
Example 15
Source File: RingtonePreference.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
protected void onClick() {
    // Launch the ringtone picker
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    onPrepareRingtonePickerIntent(intent);
    PreferenceFragment owningFragment = getPreferenceManager().getFragment();
    if (owningFragment != null) {
        owningFragment.startActivityForResult(intent, mRequestCode);
    } else {
        getPreferenceManager().getActivity().startActivityForResult(intent, mRequestCode);
    }
}
 
Example 16
Source File: RecipientPreferenceActivity.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onPreferenceClick(Preference preference) {
  Uri current;
  Uri defaultUri;

  if (calls) {
    current    = recipient.get().getCallRingtone();
    defaultUri = TextSecurePreferences.getCallNotificationRingtone(getContext());
  } else  {
    current    = recipient.get().getMessageRingtone();
    defaultUri = TextSecurePreferences.getNotificationRingtone(getContext());
  }

  if      (current == null)              current = Settings.System.DEFAULT_NOTIFICATION_URI;
  else if (current.toString().isEmpty()) current = null;

  Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, defaultUri);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, calls ? RingtoneManager.TYPE_RINGTONE : RingtoneManager.TYPE_NOTIFICATION);
  intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, current);

  startActivityForResult(intent, calls ? 2 : 1);

  return true;
}
 
Example 17
Source File: AntiTheftSetupAty.java    From Huochexing12306 with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public void onClick(View v) {
	boolean status = false;
	switch(v.getId()){
	case R.id.antiTheftStatus:
		status = MyUtils.getToogleImageStatus(ivShowAntiTheftStatus)==true?false:true;
		setSP.setAntiTheftShowStatus(status);
		MyUtils.setToogleImageStatus(ivShowAntiTheftStatus, status);
		break;
	case R.id.ring:
		status = MyUtils.getToogleImageStatus(ivRing)==true?false:true;
		setSP.setAntiTheftRing(status);
		MyUtils.setToogleImageStatus(ivRing, status);
		break;
	case R.id.vibrate:
		status = MyUtils.getToogleImageStatus(ivVibrate)==true?false:true;
		setSP.setAntiTheftVibrate(status);
		MyUtils.setToogleImageStatus(ivVibrate, status);
		break;
	case R.id.delay:
		listType = 0;
		FavoriteCharacterDialogFragment.show(this, "报警延时", strDelayTimes);
		break;
	case R.id.ringtone:
		Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
		intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "设置报警铃音");
		intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_RINGTONE);
		intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);
		startActivityForResult(intent, REQUEST_SELECT_ALARM_RINGTONE);
		break;
	case R.id.enhancedMode:
		status = MyUtils.getToogleImageStatus(ivEnhancedMode)==true?false:true;
		setSP.setAntiTheftOpenBTEnhancedMode(status);
		MyUtils.setToogleImageStatus(ivEnhancedMode, status);
		break;
	case R.id.bt:
		status = MyUtils.getToogleImageStatus(ivBTClosed)==true?false:true;
		setSP.setAntiTheftBTClosedAlarm(status);
		MyUtils.setToogleImageStatus(ivBTClosed, status);
		break;
	case R.id.sensivity:
		listType = 1;
		FavoriteCharacterDialogFragment.show(this, "静置报警灵敏度", strRestSensitivitys);
		break;
	}
}
 
Example 18
Source File: RingtonePreference.java    From AndroidBlueprints with Apache License 2.0 4 votes vote down vote up
@Override
protected void onClick() {
    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    onPrepareRingtonePickerIntent(intent);
    mParent.startActivityForResult(intent, RINGTONE_PICKER_REQUEST);
}
 
Example 19
Source File: MainPreferenceFragment.java    From kcanotify with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean onPreferenceTreeClick(Preference preference) {
    Log.e("KCA", "onPreferenceTreeClick " + preference.getKey());
    String key = preference.getKey();
    if (!isActivitySet) return false;

    if (PREF_OVERLAY_SETTING.equals(key)) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            showObtainingPermissionOverlayWindow();
        } else {
            showToast(getActivity(), getStringWithLocale(R.string.sa_overlay_under_m), Toast.LENGTH_SHORT);
        }
    }

    if (PREF_SCREEN_ADV_NETWORK.equals(key)) {
        mCallback.onNestedPreferenceSelected(NestedPreferenceFragment.FRAGMENT_ADV_NETWORK);
        return false;
    }

    if (PREF_KCA_NOTI_RINGTONE.equals(key)) {
        Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, true);
        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, DEFAULT_NOTIFICATION_URI);
        String existingValue = sharedPref.getString(key, null);
        if (existingValue != null) {
            if (existingValue.length() == 0) {
                // Select "Silent"
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) null);
            } else {
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(existingValue));
            }
        } else {
            // No ringtone has been selected, set to the default
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Settings.System.DEFAULT_NOTIFICATION_URI);
        }
        startActivityForResult(intent, REQUEST_ALERT_RINGTONE);
    }

    if (PREF_CHECK_UPDATE.equals(key)) {
        checkRecentVersion();
    }

    return super.onPreferenceTreeClick(preference);
}
 
Example 20
Source File: PreferencesActivity.java    From KlyphMessenger with MIT License 4 votes vote down vote up
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
{
	Log.d("PreferencesActivity", "onSharedPreferenceChanged " + key);
	if (key.equals(MessengerPreferences.PREFERENCE_THEME))
	{
		restart();
	}
	else if (key.equals(MessengerPreferences.PREFERENCE_APP_LANGUAGE))
	{
		String l = sharedPreferences.getString(key, "default");

		KlyphLocale.setAppLocale(l);
		
		restart();

	}
	else if (key.equals(MessengerPreferences.PREFERENCE_FB_LANGUAGE))
	{
		refreshFbLanguage();
	}
	else if (key.equals(MessengerPreferences.PREFERENCE_NOTIFICATIONS_RINGTONE))
	{
		if (MessengerPreferences.getNotificationRingtone().equals("ringtone"))
		{
			Intent ringtoneManager = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);

			// specifies what type of tone we want, in this case "ringtone", can be notification if you want
			ringtoneManager.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);

			// gives the title of the RingtoneManager picker title
			ringtoneManager.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, getString(R.string.preference_notification_ringtone_chooser));

			// returns true shows the rest of the songs on the device in the default location
			ringtoneManager.getBooleanExtra(RingtoneManager.EXTRA_RINGTONE_INCLUDE_DRM, true);

			startActivityForResult(ringtoneManager, RINGTONE_CODE);
		}
		else if (MessengerPreferences.getNotificationRingtone().equals("song"))
		{
			Intent intent = new Intent();
			intent.setType("audio/*");
			intent.setAction(Intent.ACTION_GET_CONTENT);
			startActivityForResult(Intent.createChooser(intent, getString(R.string.preference_notification_ringtone_chooser)), SONG_CODE);
		}
		else
		{
			MessengerPreferences.setNotificationRingtoneUri(null);
			refreshRingtoneSummary();
		}
	}
}