title: Android Saving Edittext content to SharedPreferences and Reading it back
body: <p>In my xml i have an edittext element like this</p>
  
  <pre><code>&lt;EditText
  android:id="@+id/hrvalue"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="64"
  android:textSize="18sp"&gt;
  &lt;/EditText&gt;
  </code></pre>
  
  <p>in my configuration class i want to read the value of the edittext and save it to a variable.
  In the edittext box the user will be inputting a number integer.
  I have wrote the following code</p>
  
  <pre><code>SharedPreferences prefs = self.getSharedPreferences("prefs", 0);
  SharedPreferences.Editor edit = prefs.edit();
  EditText hrvalue = (EditText)findViewById(R.id.hrvalue);
  edit.putString("hrvalue"+appWidgetId,hrvalue.getText().toString());
  edit.commit();
  </code></pre>
  
  <p>Could i read the value in the edittext box as integer?</p>
  
  <p>Now I want to read the value as integer in my other class but i don't know how to do it.
  The sharedpreferences key,value pairs is a bit confusing for me.
  I wrote </p>
  
  <pre><code>int hrvalue=prefs.getInt("hrvalue"+appWidgetId,1);
  </code></pre>
  
  <p>Is this correct? Is that the correct way of reading from an edittext and adding it to sharedpreferences?Where is the value of an edittextbox stored?
  I had success with checkbox but not yet with edittext.</p>
  
  <p>Thanks.</p>