Example usage for android.media RingtoneManager EXTRA_RINGTONE_EXISTING_URI

List of usage examples for android.media RingtoneManager EXTRA_RINGTONE_EXISTING_URI

Introduction

In this page you can find the example usage for android.media RingtoneManager EXTRA_RINGTONE_EXISTING_URI.

Prototype

String EXTRA_RINGTONE_EXISTING_URI

To view the source code for android.media RingtoneManager EXTRA_RINGTONE_EXISTING_URI.

Click Source Link

Document

Given to the ringtone picker as a Uri .

Usage

From source file:com.android.messaging.ui.UIIntentsImpl.java

@Override
public Intent getRingtonePickerIntent(final String title, final Uri existingUri, final Uri defaultUri,
        final int toneType) {
    return new Intent(RingtoneManager.ACTION_RINGTONE_PICKER)
            .putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, toneType)
            .putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, title)
            .putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, existingUri)
            .putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, defaultUri);
}

From source file:com.silentcircle.contacts.detail.ContactLoaderFragment.java

private void doPickRingtone() {

    Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    // Allow user to pick 'Default'
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true);
    // Show only ringtones
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_RINGTONE);
    // Don't show 'Silent'
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false);

    Uri ringtoneUri;/*from w w  w  .  j  av a2  s. c  o m*/
    if (mCustomRingtone != null) {
        ringtoneUri = Uri.parse(mCustomRingtone);
    } else {
        // Otherwise pick default ringtone Uri so that something is selected.
        ringtoneUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
    }

    // Put checkmark next to the current ringtone for this contact
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, ringtoneUri);

    // Launch!
    startActivityForResult(intent, REQUEST_CODE_PICK_RINGTONE);
}

From source file:com.android.deskclock.AlarmClockFragment.java

private void launchRingTonePicker(Alarm alarm) {
    mSelectedAlarm = alarm;//from   w ww.  jav a 2s .  com
    Uri oldRingtone = Alarm.NO_RINGTONE_URI.equals(alarm.alert) ? null : alarm.alert;
    final Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, oldRingtone);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM);
    intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, false);
    startActivityForResult(intent, REQUEST_CODE_RINGTONE);
}

From source file:com.bai.android.ui.OtherActivity.java

@Override
public void onClick(View view) {
    switch (view.getId()) {
    case R.id.edit_profile_submit:
        submit();/*w ww .j  a  va 2  s . c  o  m*/
        break;
    case R.id.profile_cancel_button:
        loadProfileData();
        break;
    case R.id.change_pw_button:
        changePswd();
        break;
    case R.id.logout_button:
        logout();
        break;
    case R.id.satellite_button:
        changeMapType();
        break;
    case R.id.change_sound_button:

        SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
        String currentRingtone = pref.getString(getResources().getString(R.string.default_sound), null);

        Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);

        if (currentRingtone == null)
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI,
                    PhraseManager.getInstance().getSound(account, null, null));
        else {
            Uri currentRingtonUri = Uri.parse(currentRingtone);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, currentRingtonUri);
            intent.putExtra(RingtoneManager.EXTRA_RINGTONE_DEFAULT_URI, currentRingtonUri);
        }

        startActivityForResult(intent, CHANGE_RINGTONE_REQUEST_CODE);

        break;
    case R.id.change_avatar_button:
        changeAvatar();
    default:
        break;
    }
}