0

Ok, so I have a list view and it contains some items. The list item has an expiry date. So, the list view contains the item till the date of expiry. After that, there should be a mechanism which can tell the list view to remove that item.

How can I do it? Can I pass a message from the list view item itself or do I have to create some other mechanism which constantly keeps checking for expiry date of all the list items in the list view?

Jeevan MB
  • 148
  • 1
  • 11
  • Thanks, but I got a hint for the answer and think I can take it from there. All I do is from the list item, as soon as the expiry date is over, I get the id of the parent and then tell it to remove the item. Or I can create another function which does that. – Jeevan MB Oct 29 '15 at 11:05

1 Answers1

0

I think you should take a tutorial or a course to understand how Java works because there are many ways to do that communication.

You should take a look at this documentation on how to create and use an interface: https://docs.oracle.com/javase/tutorial/java/concepts/interface.html

You should create a listener which is an interface and then you implement it on your activity or fragment and pass it along in the constructor of the listview's adapter.

Take a look at this answer: https://stackoverflow.com/a/18585247/3465623

Community
  • 1
  • 1
luiscosta
  • 855
  • 1
  • 10
  • 16