title: How to implement undo/redo and preserve the value on orientation change in android EditText?
body: <p>I am using the <a href="https://code.google.com/p/android/issues/attachmentText?id=6458&amp;aid=64580123000&amp;name=TextViewUndoRedo.java" rel="nofollow noreferrer">TextViewUndoRedo class</a> for undo/redo operations and it works but I want the value preserved after <code>orientation/onConfigurationChange</code>. </p>
  
  <p>There are two methods in that class: <code>storePersistentState(Editor editor, String prefix)</code> and <code>restorePersistentState(SharedPreferences sp, String prefix)</code>, what do they do? </p>
  
  <p>I guess, these are for <code>onConfigurationChanged</code> and implement in the following way, but they didn't work? </p>
  
  <pre><code>@Override
  public void onConfigurationChanged(Configuration newConfig) {
      super.onConfigurationChanged(newConfig);
  
      vNoteText = vEditNote.getText().toString();
  
      //----------------------------------------------------------------//
  
      SharedPreferences sp = getSharedPreferences("unforedopref", 0);
      SharedPreferences.Editor editor;
      editor = sp.edit();
  
      mTextViewUndoRedo.storePersistentState(editor, "undoredokey");
  
      //----------------------------------------------------------------//
  
      setContentView(R.layout.notepadmain);
  
  
      vEditNote.setText(vNoteText);
  
      //----------------------------------------------------------------//    
  
      mTextViewUndoRedo.restorePersistentState(sp, "undoredokey");
  }       
  </code></pre>
  
  <p>If you provide a undo redo technique which works <code>onOrientationChange</code> with example, it would be helpful.</p>