I am trying to add the items from my array into the listview but i always get an exception.
below is the code of how i add the items:
It should be
for(int a = 0; a < presList.size(); a++)
{
String name = presList.get(a);
String companyName = presList.get(a);
Log.d("company name:", companyName);
items.add(new EntryItem(name,companyName));
}
Let's say we have an ArrayList
with a 5 items
so accessing elements of ArrayList
starts from index 0 to 4
use
for(int a = 0; a <= presList.size()-1; a++)
OR
for(int a = 0; a < presList.size(); a++)
instead of
for(int a = 0; a <= presList.size(); a++)