i’m using an ArrayAdapter in my ListView.
I can’t really understand if when i’m setting and ArrayList to my ArrayAdapter, it recreate all the objects of it, or just reference to it.
for some reason same objects which are supposed to be the same in too list views, doesn’t get effected with property changes as if the current object is a clone of the other object..
can anyone please clear that out ?
When you pass
ArrayListto anArrayAdapter, it actually manipulates object using Pass-by Reference.And when you alter the contents of your
ArrayListand want to reflect those changes inArrayAdapter, then you must need to callnotifyDataSetChanged()method of your adapter.P.S: Practically you should pass a cloned object of your ArrayList to adapter (unless you know what you are doing), since its unnecessary and will take extra resources.
More info.