On my app user can click an item(row) on a listview to delete the clicked item(row) that was populated from a sqlite database. Is there a way to undelete the deleted items(rows) when the user clicks the back button?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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!