Skip to content Skip to sidebar Skip to footer

Update An Item In The Arrayadapter

I have an arrayadapter.I can add items to this arrayadapter,but sometimes I need the update an item in this adapter.I researched the internet and can't find anything about update s

Solution 1:

An ArrayAdapter maintains a reference to the array or List of objects that it uses. Any of the methods such as add(...), remove(...) or insert(...) act directly on the array / list and also used synchronized statements making them thread-safe.

Your approach may seem slightly long-winded but it's as safe a way of doing things as any other way. You could, of course, manipulate the original array / list yourself but if you need thread-safety you'd have to add synchronization to your own code. Why re-invent the wheel?

If you want to look at the source code for ArrayAdapter it's here

Post a Comment for "Update An Item In The Arrayadapter"