I learned that android has easy ways of handling validation using the interface OnPreferenceChangeListener. Basically, users are forced to enter a valid number since we are able to check their input before the application submit their changes.

Workflow diagram

This diagram shows how the SettingsFragment assigns the listener to TextEditPreference and validates user input in the OnPreferenceChange

visualizer screen