Shink, thank you for your answer.

the add() and insert() work as expected.
However it is a lot easier for me to manipulate directly my ArrayList
(it is more flexible and the ArrayAdapter API lack some methods). I
think I will keep my current code with the overrided getCount() method
so I don't have to add to code to keep the ArrayAdapter in sync with
my ArrayList.

On Jun 17, 1:53 pm, skink <[email protected]> wrote:
> On Jun 17, 9:37 am, Christophe <[email protected]>
> wrote:
>
> > myArrayList is a simple ArrayList :
>
> > ArrayList<Step> myArrayList = new ArrayList<step>();
>
> > which I give to my adapter in my ListActivity :
>
> > adapter = new StepItemAdapter(this, myArrayList);
> > this.setListAdapter(adapter);
>
> if your StepItemAdapter extends ArrayAdapter you dont need myArrayList
>
>
>
> > Later I add item to my list and try to refresh the view :
>
> > myArrayList.add(position, new Step());
> > adapter.notifyDataSetChanged();
>
> just use adapter.add() and/or adapter.insert()
>
> pskink

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to