how to undo any function

522 views android

Is there a way to undo last function/method which is just finished to work?

for example I have a function:

fun changeInfo(isTrue: Bolean, num: Number) {
isTrue = false


and many more functions. Each function start to work when user presses certain button on a screen. User should have possibility to undo his last action. Is there universal way to undo any function which just finished to work?

Of course, I can do this way:


but that to do if there is many functions? Is there easy way to undo any function (android)?

answered question

Please do not tag languages that are not related to your question.

1 Answer


No, you can't. I don't know any language or platform where you can do something like that.

Any code that your application executes modifies data in memory in some way (creates or destroys objects, changes values etc.). In order to undo changes made by that code operating system should save the full history of data modifications and that is practically impossible because of limited resources.

posted this

Have an answer?


Please login first before posting an answer.