General preferences - choose the basic implementation of the ringtone

I am almost at the stage when my application reaches a good state. So far for everything that I used only by default, but now I want the user to be able to select a ringtone to notify about this.

My code for default values:

        note.defaults |= Notification.DEFAULT_SOUND; 

Does anyone know where a good tutorial is located, or is there some code that they could share to change this to user-customizable tunes? I looked at the documentation, but found it a bit confusing. Any help is much appreciated, as always.

Edit: I think part of the XML of this looks fine, it's just the Java / Android side I'm having problems with - thanks!

+3
source share
1

, RingtonePreference . , SharedPreferences. ,

note.defaults |= Notification.DEFAULT_SOUND;

note.sound = Uri.parse(context.getSharedPreferences("my_preferences_file_name", 0).getString("the_name_of_your_ringtone_preference", ""));
+2

All Articles