EditBoxPreference() storing the value as an int instead a string
<p>I'm writing an Android application that can easily back up files and folders to the users PC. One of the things I wanted to implement was allowing the client running on the Android device to change the port I will be sending the file to.</p>

<p>For this, I've created an EditTextPreference to store the value.</p>

<p>The code I'm using to get this value back is </p>

<pre><code>port = prefs.getString("serverPort", "&lt;unset&gt;");
</code></pre>

<p>However, this returns a string and I need an int, so I tried to use</p>

<pre><code>sendPort = Integer.parseInt(port);
</code></pre>

<p>But this crashes the Android application, with (I think) a number format exception.</p>

<p>Is there anyway I can explicitly store the value that is entered as an Integer to make it easier?</p>

<p>I tried to use the method</p>

<pre><code>port = prefs.getInt(...);
</code></pre>

<p>but that didn't work either.</p>

<p>Thanks for any help.</p>
