开发者

Restore a deleted item/items on SQLite database when back button is pressed

开发者 https://www.devze.com 2023-04-09 05:14 出处:网络
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 th

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!

0

精彩评论

暂无评论...
验证码 换一张
取 消