Over a million developers have joined DZone.

How to Implement an "Undo" Bar in Android

DZone's Guide to

How to Implement an "Undo" Bar in Android

· Java Zone
Free Resource

Bitbucket is for the code that takes us to Mars, decodes the human genome, or drives your next car. What will your code do? Get started with Bitbucket today, it's free.

Users hate to lose data, and it's a tough situation when it's a user error that leads to the loss. One solution, though, is a simple "undo" button, which can be a little bit difficult to implement on Android. So, here's a solution from Jens Driller: Android - UndoBar.

It's small and simple, and does exactly what it sounds like - a notification (modeled after Gmail's) that includes a message about the items deleted and an undo button - and it looks like this on pre-KitKat devices:

alt textalt text

And like this post-KitKat:

alt textalt text

Clean, easy to use, and good-looking. Check it out if you're interested in a simple yet useful solution, or if your users just keep accidentally deleting their stuff.

Are you using Bitbucket to accomplish your company's mission? Share your company’s mission with #Forthecode for a chance to be featured on our homepage, our social media channels, or win a free t-shirt!


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}