There is no way to do this automatically ... you will have to do it manually. You have two alternatives:
ArrayList<String> someItems = new ArrayList<String>();
for(String element : itemsarray)
someItems.add(element);
setListAdapter(new ArrayAdapter<String>(this, R.layout.row, R.id.label, someItems));
Or you can subclass ArrayAdapterand override the method getCountthat returns X. It will make the list think that it simply displays X elements.
source
share