title: SharedPreferences in a edittext of a AlertDialog
body: <p>I'm using <code>TextToSpeech</code> for the first time and i have a problem.. I created a dialog with a editText where i can write something:</p>
  
  <pre><code>AlertDialog.Builder alert = new AlertDialog.Builder(this);
  
  alert.setTitle("Title");
  alert.setMessage("Message");
  
  // Set an EditText view to get user input 
  final EditText input = new EditText(this);
  alert.setView(input);
  
  alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
  public void onClick(DialogInterface dialog, int whichButton) {
    value = input.getText().toString();
    // Do something with value!
    }
  });
  
  alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int whichButton) {
      // Canceled.
    }
  });
  
  alert.show();
  </code></pre>
  
  <p>I need save in preferences that value.</p>
  
  <p>I created this one:</p>
  
  <pre><code>private void prefvalue(String tag) {
    String name = savename.getString(Tag, null);
    SharedPreferences.Editor preferencesEditor = savename.edit();
    preferencesEditor.putString("tag", tag);
    preferencesEditor.commit();
  }
  </code></pre>
  
  <p>well.. now in onCreate what have i to do? Because i tried do something like</p>
  
  <pre><code>input.setText(savename.getString("tag", Default Value"));
  </code></pre>
  
  <p>where <code>input</code> is the editText inside the AlertDialog. But of course doesn't work because it doesn't find the <code>input</code> variable.</p>