1

How would one do that and is it a good idea?

The idea is to save and restore the multiple objects stored within the adapter.

Edit: Basically I've got an ArrayAdapter containing multiple objects added as follows

adapter.add ( object );

I'd like to be able to save and restore the adapter so I can use it as

setListAdapter ( adapter );

I suppose it would be possible to create an ArrayList and iterate through that when I save / restore, but that seems like an extra step

abc32112
  • 2,457
  • 9
  • 37
  • 53
  • 2
    Serialize the array not the array adapter – jbat100 Oct 31 '13 at 12:32
  • What are you trying to do? There may be a better way to do this. – Rarw Oct 31 '13 at 12:32
  • What if the ArrayAdapter doesn't contain an array, but objects added as: "adapter.add ( object )"? – abc32112 Oct 31 '13 at 12:33
  • Please read your last comment. I am struggling to understand how an **Array** Adapter cannot "contain" an array. – Simon Oct 31 '13 at 19:58
  • I would guess it can, but instead of adding objects to an array that I then add to the ArrayAdapter, I add the objects one and one directly to the ArrayAdapter. Perhaps I'm misunderstanding you. Anyway, the workaround I came up with to my probem is to store all objects in an ArrayList and serialize that, instead of the ArrayAdapter as I would have liked to. – abc32112 Nov 01 '13 at 14:42

0 Answers0