Skip to content Skip to sidebar Skip to footer

Arraylist Adapter Constructor Fails (?)

EDIT: Need to know how to create an ArrayList filled by a Textview I am trying to create an ArrayAdapter for a Multidimensional (2D) ArrayList: final ArrayAdapter

Solution 1:

If you were creating an adapter for a list of strings it would like this:

ArrayList<String> array = new ArrayList<String>();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, android.R.id.text1, array);

So an adapter for a list of lists of strings would look like:

ArrayList<ArrayList<String>> array = new ArrayList<ArrayList<String>>();
ArrayAdapter<ArrayList<String>> adapter = new ArrayAdapter<ArrayList<String>>(this,android.R.layout.simple_list_item_1, android.R.id.text1, array);

Post a Comment for "Arraylist Adapter Constructor Fails (?)"