android - ArrayAdapter Initializing not Clear -
i trying create list containing names of available applications on phone triggering implicit intent. being beginner in android following tutorials book. have created custom adapters extending arrayadapter before syntax of simple arrayadapter not being clear me. here is:
arrayadapter<resolveinfo> adapter = new arrayadapter<resolveinfo> (getactivity(),android.r.layout.activity_list_item,activities) { @override public view getview(int position, view convertview, viewgroup parent) { // todo auto-generated method stub view v = super.getview(position, convertview, parent); textview tv = (textview)v; resolveinfo ri = getitem (position); tv.settext(ri.loadlabel(pm)); return v; } };
1- why method getview being called in within parenthesis after calling constructor of arrayadapter?
2- kind of anonymous class structure?
3- in reality custom adapter object type of resolveinfo?
any appreciated. thanks
getview(int position, view convertview, viewgroup parent)
called within brackets because constructingnew
array adapter, , therefore must provide required methods adapter.yes is
yes, creating customized
arrayadapter
arrays of object resolveinfo,
i assume have extended arrayadapter class implementing own java class file, doing same thing. benefit implementing own java class file thatyou can use same arrayadapter
anywhere in project. however, if place need adapter, may better implement way.
Comments
Post a Comment