0

I was following one of the answers in this link, and I found it rejecting my code, and not letting me compile due to an error stating "The constructor ArrayAdapter(Context, int, int, String[][]) is undefined". Anyone have any ideas? I am taking my data from a two diminutional array, please forgive me I am quite new at this. Thanks!

ArrayAdapter<String> adapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_2, android.R.id.text1, values[][]) {
              @Override
              public View getView(int position, View convertView, ViewGroup parent) {
                View view = super.getView(position, convertView, parent);
                TextView text1 = (TextView) view.findViewById(android.R.id.text1);
                TextView text2 = (TextView) view.findViewById(android.R.id.text2);

//not yet ready altered for my code
                text1.setText(persons.get(position).getName());
                text2.setText(persons.get(position).getAge());
                return view;
              }
            };
Community
  • 1
  • 1
timbats1993
  • 101
  • 2
  • 7
  • in your case you need to use SimpleAdapter [A Example](http://www.java2s.com/Code/Android/UI/UsingSimpleAdaptertofilldatatoListView.htm) – Bharatesh May 10 '15 at 14:34
  • What is `values[][]`? An ArrayAdapter works with a list or 1-dimensional array. You can't use a 2D array. How do you anticipate your array data being displayed? – pathfinderelite May 10 '15 at 14:40
  • Ah damn. I was hoping that wasn't the case. I wanted the data to be displayed with one item of the array as a heading, and the second dimension would be the subheading – timbats1993 May 10 '15 at 14:50
  • You might want to implement a BaseExpandableListAdapter – Mark May 10 '15 at 17:00

0 Answers0