Allay Khalil
Allay Khalil

Reputation: 693

How to delete using long click or using swipe to delete

I have a listview that is working fine. Now I have one option to enable and that is deleting the row. I know this is not a problem But Want to take some suggestions. and that is what is a best way of deleting the item(row). Here what I have tries I am sharing with you

  1. Used Context Menu on long click but they do not look cool and quite old.
  2. Used Swipe to Delete but there comes some problems which are not working good, I mean there are some problems in it. here is the reference of my question about that.
  3. Can any one please come up with some suggestion of deleting the row which are new and good ways to do so.

What are prerequisites :

I am using fragments with one single activity and using tool bar so I really can use delete option appearing in toolbar for only one fragment . Actually I do not know how to do it.

So please tell me what are the good and best way which are user friendly , looks good in gui and also a Beginner developer friendly

Upvotes: 1

Views: 633

Answers (2)

am110787
am110787

Reputation: 316

You can use Recyclerview instead of ListView. It has default animation while adding/removing items. You can check the code here or you can provide cross icon in the item and delete on click of it.

Upvotes: 0

Raghu Nagaraju
Raghu Nagaraju

Reputation: 3288

One solution is,

  • Add hidden checkbox in each listview row.

  • Add delete button on the toolbar/actionbar.

  • OnClicking delete button show checkboxes to select multiple items to delete.

  • Again clicking on delete should ask confirmation dialog and delete if user agrees.

Upvotes: 1

Related Questions