Perform an action when leaving page

Hello,

I need to perform some clean up when the user tries to leave the current page. What is the best way to acomplish this?

Small example would be great.

Thanks.

You can override the detach() method. Remember to call the superclass.

Thanks for the response.

In the meantime I’ve managed to get this to work with addViewChangeListener. I do the clean up in the beforeViewChange and always return true.