I have an empty arraylist of objects that has global scope. I need to add items to the arraylist from a different activity and also not to add items that are already present in it( no duplicates ).
I have an issue when the item is added to the list from an activity in which the item is received from an intent, the item gets added even if the list contains the item already. However the item is added only once on the activity starts.
But on finnishing the activity and starting it again adds the item again creating duplicates.
I simply use the arraylist.contains(object) to check if the object is present in the list. Is there any way I can not get the duplicates or remove them?