i'd like to change my EditTextPreference because I need to query the contact list to recover phone numbers.
The problem is that I need to change the "onClick" method for an EditTextPreferences.
So how can I do that ?
numeros = (EditTextPreference)findPreference("phone_number");
numeros.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivityForResult(new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI),REQUEST_CODE_PICK_CONTACTS);
return true;
}
});
I did it and it worked, but the dialog stays, can we delete it ?
I just found, I change my EditTextPreference to a Preference and it worked.
numeros = findPreference("phone_number");
numeros.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
startActivityForResult(new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI),REQUEST_CODE_PICK_CONTACTS);
return true;
}
});