How can I make ringtone activity (that always appear in setting) so the user can choose her ringtone from system ringTones I googled it but I didn’t find complete tutorial, I am really confused, please give me tutorial or some codes.
Also, if I want the user to choose the special ringtone to Notification in my application should i use Shared preference or preference?
I already did the Menu:
// Menu Code Part#2
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.about:
startActivity(new Intent(this, About.class));
return true;
case R.id.help:
startActivity(new Intent(this, Help.class));
return true;
case R.id.setting:
startActivity(new Intent(this, Setting.class));
return true;
default:
return super.onOptionsItemSelected(item);
}
Full code:
res/xml/preferences.xml
Preferences.class
Your code go here:
To read these preferences from code, we should create a
getPrefs()method, which we can call in theonStart()method. When we call it in theonStart()method instead ofonCreate(), we can be sure that the preferences load when we have set them and returned to our main activity,The
getPrefs()method could look like this:androidmanifest.xml