 <p>Your Preferences in XML, even if you set <code>android:inputType="number"</code> are still stored as a String</p> <p>You have 2 choices: </p> <p>1) the 'not-so-nice': <code>Integer.parseInt( preferences.getString("defaultTip", "15"));</code></p> <p>2) Using your own type of Integer Preference. More complicated to set in first place but really better (similar question here: <a href="http://stackoverflow.com/a/3755608/327402">http://stackoverflow.com/a/3755608/327402</a>)</p>