How to manage undo after swipe to delete in android ListView?

user2364935 picture user2364935 · Aug 30, 2013 · Viewed 11.2k times · Source

I need to implement swipe to delete in a ListView with Undo function as in Gmail App

I know that there are questions already asking about swipe to delete like

Remove item listview with Slide - Like Gmail

and

android swipe to delete list row

But none of them explains how to manage Undo after deletion and Animate back the deleted view on undo!

I found other one with no Answer here

How to implement gmail like Achieve or Undo action in a list item

So here is my question.

How to create a listview in android with swipe to delete then show UNDO in the deleted space and Animate back the same view if the undo is pressed, also remove the undo option on scroll or other item click or swipe?

You smart people have any idea?

| ----------- ITEM 1-----------|

| ----------- ITEM 2-----------|

| --Deleted-------<[UNDO]>|

| ----------- ITEM 4-----------|

| ----------- ITEM 5-----------|

note: sorry that I cant add an image because of my low reputation!

Answer

user2760845 picture user2760845 · Sep 9, 2013

You can find exactly what you asked for at https://github.com/nhaarman/ListViewAnimations