Example usage for android.media RingtoneManager EXTRA_RINGTONE_DEFAULT_URI

List of usage examples for android.media RingtoneManager EXTRA_RINGTONE_DEFAULT_URI

Introduction

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

Prototype

String EXTRA_RINGTONE_DEFAULT_URI

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

Click Source Link

Document

Given to the ringtone picker as a Uri .

Usage

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();/*from  w  w  w  .j  av a 2 s.  co 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;
    }
}