On Fri, Oct 24, 2008 at 6:13 AM, Ernest Jojart <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to change the default ringtone from my application. The program
> launch Ringtone Picker activity, and when it returns, I want to set the
> chosen ringtone as the default. The reference says that
> RingtoneManager.EXTRA_RINGTONE_PICKED_URI contains the URI of the selected
> ringtone. The I called the RingtoneManager.setActualDefaultRingtoneUri
> method, but the result is not what I'm waiting for. Can anybody help me what
> would be the problem with this code?
>
> private void setAsRingtone()
> {
> Intent i = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
> startActivityForResult(i, ACTIVITY_SET_RINGTONE);
> }
> ...
>
> @Override
> protected void onActivityResult(int requestCode, int resultCode, Intent
> data) {
> switch(requestCode){
> case ACTIVITY_SET_RINGTONE:
> RingtoneManager.setActualDefaultRingtoneUri(this,
> RingtoneManager.TYPE_RINGTONE,
> Uri.parse(RingtoneManager.EXTRA_RINGTONE_PICKED_URI));
You forgot to fetch the value from the data's extras :) Try:
RingtoneManager.setActualDefaultRingtoneUri(this,
RingtoneManager.TYPE_RINGTONE,
Uri.parse(data.getStringExtra(getRingtoneManager.EXTRA_RINGTONE_PICKED_URI)));
jason
>
> }
>
> }
>
> Thank You in advanced!
>
> B.r.:
>
> Ernest
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---