Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get all elements of an ArrayAdapter?

I need get all elements of ArrayAdapter of an ListView.

Like this:

    this.array = new ArrayAdapter<DocumentoDominiabilidade>(getActivity(),
            android.R.layout.simple_list_item_1);
    this.documentosDominiabilidade.setAdapter(array);

// after many operations

this.array.getAllElements() // return a List of Elements????

thank you

like image 236
Rafael F. Avatar asked Jul 17 '13 22:07

Rafael F.


1 Answers

Using Adapter.getCount() you can know how many items you have in the adapter, while using Adapter.getItem(index) will give you the item.

for(int i=0 ; i<adapter.getCount() ; i++){
   Object obj = adapter.getItem(i);
}
like image 194
JafarKhQ Avatar answered Oct 12 '22 09:10

JafarKhQ