android EditTextPreference onclick

i'm making a settings activity and i want to let user picks sound notification. Im using this to do it:

EditTextPreference dataPref = (EditTextPreference) findPreference("opcion3");

        dataPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {

            public boolean onPreferenceClick(Preference preference) {
                Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TITLE, "Select Tone");
                intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, (Uri) null);
                Ajustes.this.startActivityForResult(intent, 5);          
                return true;
            }
          });  

But when I click the EditTextPreference it shows a editbox with OK and cancel, and inmediatly it shows list of notification sounds.

How can i make it only shows the notifications sounds?

Answers


Why do you use EditTextPreference? Use RingtonePreference or create custom Preference.

<RingtonePreference 
    android:key="notification_sound" 
    android:ringtoneType="notification" 
    android:title="Notification Sound" 
    android:defaultValue="content://settings/system/notification_sound"
    android:showDefault="true" 
    android:showSilent="true" />

Need Your Help

VBA code search and format text in word document - infinite loop

vba loops search

I have written the below code to search through a word document to select text between to words (i.e. from "Hide Note" to "Hide Note"). Once the text is selected it is then shaded. I want the cod...

awk searching for multiple fields

bash search awk

I encountered a difficulty during my assignment and would like some clarification.