I'm getting myself in a muddle with an ArrayAdapter I'm trying to put together. I've got a constructor, Person, which is used to put together people to go in a list. I'm then putting together an ArrayList of type Person to make a readable list.
I then put together an ArrayAdapter so that the list can be seen in a ListView, but I'm constantly getting "Cannot resolve constructor" with my code.
I've tried countless possible solutions on this site including trying to use getActivity() or this in place of PeopleActivity.this, but I just cannot get my code to compile. I've also tried referencing my constructor class in the ArrayAdapter, but that just gives me an error that it's not an enclosing class.
Person.class (constructor)
import android.text.Editable;
public class Person {
public Person Person;
private Editable personName;
public Person(Editable a) {
personName = a;
}
public void setName(Editable personName){
this.personName = personName;
}
public Editable getName() {
return personName;
}
}
PeopleActivity - populateListView
ArrayList<Person> peoplelistv = new ArrayList<Person>();
...
private void populateListView() {
ListView list = (ListView) findViewById(R.id.peopleListView);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(PeopleActivity.this, android.R.layout.simple_list_item_1, peoplelistv);
list.setAdapter(adapter);
}
Any ideas folks?
Thanks