I am trying to apply Undo and Redo operation while writing or applying effect to my EditText. For that i have downloaded class from this Link and then i have used it like this in my app.
For Undo
TextViewUndoRedo mTextViewUndoRedo = new TextViewUndoRedo(edtNoteDescription);
mTextViewUndoRedo.undo();
For Redo
TextViewUndoRedo mTextViewUndoRedo = new TextViewUndoRedo(edtNoteDescription);
mTextViewUndoRedo.redo();
But i don't know why this code does not work, I have put the log and check whether the function Undo is called or not and unfortunately i saw that it is calling this function but it goes inside below method.
if (edit == null) {
return;
}
I have also tried with some other solution with no luck, So if anyone who has implemented the same with this method or with any other method then please do suggest some code or way to implement this functionality.
Edit
btnUndo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
TextViewUndoRedo mTextViewUndoRedo = new TextViewUndoRedo(edtNoteDescription);
mTextViewUndoRedo.undo();
}
});