Intents and Uris, for Ringtone Picker

by droozen » Fri, 13 Mar 2009 00:02:59 GMT

Sponsored Links
 I'd like to allow the user to choose a Ringtone from my application,
that I will play later for an alarm. Looking at the javadocs, I see
EXTRA_RINGTONE_DEFAULT_URI in RingtoneManager, and extra that, it
says, is Given to the ringtone picker as a Uri. There is also an
EXTRA_RINGTONE_PICKED_URI that I would get from the returning intent:
Returned from the ringtone picker as a Uri

However, I see no intent.putExtra(String, Uri) function, so no option
to give a Uri. And there is no getUri(String) function in the Bundle
for me to get a Uri in return.

Is the RingtoneManager documentation wrong and it is given and
returned as, say, a String? Or what am I missing?

Intents and Uris, for Ringtone Picker

by Dianne Hackborn » Fri, 13 Mar 2009 02:58:27 GMT

 Uri is a Parcelable, so you can just use intent.putExtra(String,

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.


Sponsored Links

Intents and Uris, for Ringtone Picker

by Jason Parekh » Fri, 13 Mar 2009 05:33:15 GMT

 If you're using a preference activity, check out on the
RingtonePreference, it does a lot of the boilerplate work for you.



Intents and Uris, for Ringtone Picker

by droozen » Fri, 13 Mar 2009 05:34:09 GMT

 Ah, thanks. I was only look at what Uri extends (Object) and didn't
notice that it implemented Parcelable. Thanks!


Other Threads

1. Getting build number/version programatically

Does anyone know of a way to get the version/build number
programatically? I dug into Settings source code, it indicated that
this info could be read from the file /proc/socinfo, but this file
doesn't seem to exists on any of the devices I'm working with?!
Wondering where else I might be able to get this info. Thanks


2. Blank option in Spinner


I have a spinner which I would like to add a blank option to so that
by default no choice is selected. I've looked around and in the
Spinner class, but I can't see how to do this. I am just wondering if
there is a method already for doing this.

Thanks for any ideas.


3. Extending Theme.Dialog Problem

4. Upload image to Flickr

5. How to bind XML data to List view?

6. Are apps able to make money in Android Marketplace? (or, what is the business case?)

7. Where can i find a (complete) reference of XML files for layouts/drawables/etc