title: get String from Preferences
body: <p>I have EditText in preferences and I also have EditText in my layout.So I want to get string from Preferences and use it for EditText when i click my button.So i tried like this : </p>
  
  <pre><code>public class MainActivity extends Activity{
  
       SharedPreferences sharedPreferences;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          sharedPreferences = PreferenceManager
                  .getDefaultSharedPreferences(getBaseContext());
  }
  //OnClick method
  public void Button(View view) {
  EditText et1 = (EditText) findViewById(R.id.edittext);
              String string = sharedPreferences
                      .getString("ime", "default");
              et1.setText(String.valueOf(string));
  }
  </code></pre>
  
  <p>and my prefs xml : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
      &lt;EditTextPreference android:title="Uredi Text"
          android:key="ime"
          android:summary="ime pjesme"
  
          /&gt;
  
  
  &lt;/PreferenceScreen&gt;
  </code></pre>
  
  <p>And Everytime when I click the button EditText text becomes "default"</p>