title: Getting/Setting values SharedPreference globaly
body: <p>Hi i have a class (<code>MyCustomForm.xml</code>) which i use as a <code>LoginForm</code> for the user.
  Now i want to save and load the value from the username(<code>EditText</code>) from the <code>LoginForm</code> using <code>SharedPreferences</code> but i do not know how to set the value of username saved by <code>SharedPreferences</code> into the <code>EditText</code> in <code>LoginForm(MyCustomForm.xml</code>).</p>
  
  <p>I was thinking to save the value in <code>OnPause</code> in my Main.xml and load the value through <code>OnCreate</code> in the class <code>MyCustomForm.xml</code></p>
  
  <p>Generaly i would like to use <code>SharedPreferences</code> globaly.</p>
  
  <p>How would this look like?
  Can somebody please help me to get on the right track?</p>
  
  <p>It was thinking something like this <code>Main.xml</code>:</p>
  
  <pre><code>public class AndroidLogin extends Activity implements OnClickListener {
  
  @Override     
  protected void onPause() { 
     super.onPause();  
       Editor e = mPrefs.edit();
       e.putString(USERNM, username);
       e.commit();
  }
  }
  </code></pre>
  
  <p>Code <code>MyCustomForm (LoginForm</code>):</p>
  
  <pre><code>public class MyCustomForm extends Dialog {
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      setContentView(com.sencide.R.layout.inlogdialog);
  
      EditText userTest = (EditText)findViewById(R.id.txtUserName);
      userTest.setText(USERNM);
  }
  }
  </code></pre>