I have read many answers on this question but my question is asking where I put the code. I am looking to prove that there is more than 100 number in edittextpreference
. This code I use to populate preferecnes:
spreads the public section SettingsFrag PreferenceFragment {// onCreate Override so that code will start running when the activity is running. Override public null at @reate (bundle saved instenstate) {// Call superclass in super.onCreate (savedInstanceState); // Adding Preferences from XML Files addPreferencesFromResource (R.xml.preferences); }
}
I add verificationhere it is or I must create another category
preferences.xml:?
& lt; Android: key = "geofence_range" Android: title = "Geofence size" Android: DefaultValue = "500" Android: inputType = "number" Android: Summary = "Geofence Sizes around user space" Android: dialogTitle = "Size ( Meter): "/>
EditTextPreference
setOnPreferenceChangeListener
Add> after addPreferencesFromResource
to validate data input for the user.
EditTextPreference edit_Pref = (EditTextPreference) getPreferenceScreen () findPreference ("geofence_range"); Edit_Pref.setOnPreferenceChangeListener (New OnPreferenceChangeListener) {@Override Public Boolean onPreferenceChange (preference preference, put verification here ... newValue object) {// if (
Comments
Post a Comment