Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android EditTextPreference disable Dialog

I want to disable(not show) the Dialog, when i click the EditTextPreference in a Preference Activity.

When i click the EditTextPreference, a pop up dialog show. Now i want to disable this. I try set an onclicklistener, but the dialog show same.

public class Settings extends PreferenceActivity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings);       
   EditTextPreference userName=(EditTextPreference) findPreference("prefUsername");
    userName.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {

            return false;
        }
    }); ...

I try add this to the EditTextPreference: android:clickable="false", but nothing.

like image 705
lumoss Avatar asked Jul 16 '26 07:07

lumoss


1 Answers

Disable it.

Use

android:enabled="false"

in XML. Or to disable in runtime,

userName.setEnabled(false);

Actually, if you do not want a dialog, you probably should use simple Preference instead of EditTextPreference.

like image 172
ozbek Avatar answered Jul 17 '26 20:07

ozbek