java - Cannot resolve constructor when using ArrayAdapter -
i'm getting myself in muddle arrayadapter i'm trying put together. i've got constructor, person, used put people go in list. i'm putting arraylist of type person make readable list.
i put arrayadapter list can seen in listview, i'm getting "cannot resolve constructor" code.
i've tried countless possible solutions on site including trying use getactivity() or in place of peopleactivity.this, cannot code compile. i've tried referencing constructor class in arrayadapter, gives me error it's not 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
you declaring arrayadapter
arrayadapter<string>
. however, third parameter passing constructor neither string[]
nor list<string>
. if trying wrap arraylist<person>
in arrayadapter
, needs arrayadapter<person>
, not arrayadapter<string>
.
Comments
Post a Comment