Why doesn’t this work?
Uri ringtoneuri=Uri.parse("/sdcard/myapp/customsounds/test.3gpp");
RingtoneManager.setActualDefaultRingtoneUri(this,
RingtoneManager.TYPE_RINGTONE, ringtoneuri);
When I run this my ringtone ends up getting set to the default. I
know the file is accessible because right after the above code I have
this and the ringtone plays.
RingtoneManager.getRingtone(this, ringtoneuri).play()
On Mar 26, 10:21 pm, for android <[email protected]> wrote:
> Yes you are missing in the onActivityResult
>
> U need to check the result code.
>
> Look @ the sample i have attached.
>
> @Override
> protected void onActivityResult(int requestCode, int resultCode, Intent
> data) {
> switch (resultCode) {
> /*
> * case RESULT_OK: this.setResult(RESULT_OK); this.finish(); break;
> */
>
> case RESULT_OK:
> Uri uri = data
>
> .getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
> Log.i("Sample", "uri " + uri);
> RingtoneManager.setActualDefaultRingtoneUri(this,
> RingtoneManager.TYPE_RINGTONE, uri);
> break;
> }
> }
>
> On Thu, Mar 26, 2009 at 10:00 AM, damnesia <[email protected]>wrote:
>
>
>
>
>
> > Hello. I tried to post earlier and my browser was acting funky. I
> > don't see the post, so I am adding another. I apologize if both show
> > up.
>
> > I am using Android SDK 1.1_r1. I want a user to be able to open the
> > ringtone picker, select a ringtone, it the "OK" button and have the
> > result sent back to the parent activity. When I start the ringtone
> > picker as a sub-activity, it appears to call setResult() immediately.
> > I could be way off and just not understand how this works. Here is the
> > code that I am using to lauch the sub-activity:
>
> > mPickRingTone.setOnClickListener(new View.OnClickListener()
> > {
> > public void onClick( View v )
> > {
> > ringMe.startRingPick();
> > }
> > });
>
> > private void startRingPick()
> > {
> > 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:
> > Log.d(toString(), "ACTIVITY_SET_RINGTONE DONE");
> > // this method takes the data
> > getToneToRing(data);
> > }
>
> > super.onActivityResult(requestCode, resultCode, data);
> > }
>
> > When I press the button the ringtone picker dialog opens and
> > immediately I see "ACTIVITY_SET_RINGTONE DONE" via LogCat. This is on
> > a physical device.
>
> > Do I not understand something?
>
>
>
> Sample.zip
> 34KViewDownload- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---