Restore a deleted item/items on SQLite database when back button is pressed
On my app user can click an item(row) on a listview to delete the clicked item(row) that was populated from a sql开发者_如何学Goite database. Is there a way to undelete the deleted items(rows) when the user clicks the back button?
You would need a Redo/Undo Action. Something that stores specific actions like deleting, and can undo them by undeleting or redoing by redeleting. There are a ton of tutorials out with sample code. Should be easy for a simple delete/undelete.
As for using the Back button. You can add a KeyListener that overrides the default implementation and uses your code instead. It is highly discourages, I would suggest making a undo icon in the ActionBar instead.
Good luck!
精彩评论