Hello. Probably I misunderstand something, but why

RingtoneManager.getRingtone(this,
Settings.System.DEFAULT_RINGTONE_URI);

always returns null when launching from my activity? Shouldn't it
return some object which is System.DEFAULT_RINGTONE_URI, which I can
then play() ?

Is there any small example of code which shows how to play Ringtone
from Activity? MediaPlayer way also not works.

MediaPlayer.create(this, Settings.System.DEFAULT_RINGTONE_URI)

simply crashes with:

02-01 11:19:51.008: ERROR/TAG(351): null
02-01 11:19:51.008: ERROR/TAG(351): java.lang.NullPointerException
02-01 11:19:51.008: ERROR/TAG(351):     at
android.content.ContextWrapper.getContentResolver(ContextWrapper.java:
89)
02-01 11:19:51.008: ERROR/TAG(351):     at
android.media.MediaPlayer.setDataSource(MediaPlayer.java:589)
02-01 11:19:51.008: ERROR/TAG(351):     at
android.media.MediaPlayer.create(MediaPlayer.java:516)
02-01 11:19:51.008: ERROR/TAG(351):     at
android.media.MediaPlayer.create(MediaPlayer.java:497)

Please help!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to