# TIP: Undo Delete

DevFeed: [TIP: Undo Delete](<https://devfeed.tech/articles/tip-undo-delete-19603.md>)

Original publisher: [Read original article](<https://www.codenameone.com/blog/tip-undo-delete/>)

Author: Shai Almog

Published: 2018-12-10T00:00:00Z

Content type: tutorial

Language: en

Sources: [CodeName One](<https://devfeed.tech/sources/codename-one.md>)

Topics: [Mobile](<https://devfeed.tech/topics/mobile.md>), [Filesystems](<https://devfeed.tech/topics/filesystems.md>), [Code](<https://devfeed.tech/topics/code.md>), [ui](<https://devfeed.tech/topics/ui.md>)

Tags: [callback](<https://devfeed.tech/tags/callback.md>), [code](<https://devfeed.tech/tags/code.md>), [mobile](<https://devfeed.tech/tags/mobile.md>), [storage](<https://devfeed.tech/tags/storage.md>), [thread](<https://devfeed.tech/tags/thread.md>), [ui](<https://devfeed.tech/tags/ui.md>)

## AI overview

A mobile development tip explains how to implement undoable file deletion when apps cannot rely on a shared operating-system trash can. The approach moves deleted files into an app-managed trash directory, supports restoration, and can permanently delete unrecovered files after 10 seconds.

## Source excerpt

One of my pet peeves is the "Are you sure?" dialog. I've used it a lot myself because it's the "easy way out", but when possible I try to avoid it. This is especially important in mobile where constant prompts really slow down the workflow. The trick that lets us avoid the "Are you sure?" dialog is the undo option. Once you can undo an operation you can move fast and let users reconsider later. With file deletion this is a bit harder. Most OS's provide a trash can abstraction. This doesn't exist in mobile devices where apps are effectively segregated from one another. However, implementing our own trash can is pretty trivial.