Saturday 15 August 2015

android - ListView choiceMode overridden after using with custom adapter? -



android - ListView choiceMode overridden after using with custom adapter? -

i having listview beingness set custom adapter class. in layout, setting choicemode listview.

<listview android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:choicemode="multiplechoice" android:cachecolorhint="#00000000" />

however checkboxes aren't appearing on listview. because choicemode behaviour overridden using custom adapter? how set choicemode in such case?

update: next adapter code:

public class contanctadapter extends arrayadapter<contactbean> { private activity activity; private list<contactbean> items; private int row; private contactbean objbean; public contanctadapter(activity act, int row, list<contactbean> items) { super(act, row, items); this.activity = act; this.row = row; this.items = items; } @override public view getview(final int position, view convertview, viewgroup parent) { view view = convertview; viewholder holder; if (view == null) { layoutinflater inflater = (layoutinflater) activity .getsystemservice(context.layout_inflater_service); view = inflater.inflate(row, null); holder = new viewholder(); view.settag(holder); } else { holder = (viewholder) view.gettag(); } if ((items == null) || ((position + 1) > items.size())) homecoming view; objbean = items.get(position); holder.tvname = (textview) view.findviewbyid(r.id.tvname); holder.tvphoneno = (textview) view.findviewbyid(r.id.tvphone); if (holder.tvname != null && null != objbean.getname() && objbean.getname().trim().length() > 0) { holder.tvname.settext(html.fromhtml(objbean.getname())); } if (holder.tvphoneno != null && null != objbean.getphoneno() && objbean.getphoneno().trim().length() > 0) { holder.tvphoneno.settext(html.fromhtml(objbean.getphoneno())); } homecoming view; } public class viewholder { public textview tvname, tvphoneno; } }

check createviewfromresource method of custom adapter, problem there likely. anyway can more help if post yours adapter code (though standart ui part)

android android-listview

No comments:

Post a Comment