arraylist - Adding a RadioButton to a itemView adapter within a ListView -
i wonder if can , please?
this code below listview adapter enable single itemview works well. iam able show adapter barcode number , time of item read barcode reader in listview.
my question how add radio button each item ?
public view getview(int position, view convertview, viewgroup parent) { inflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); map<string, object> result = arrayc.get(position); textview txttime; textview txtbarcode; view itemview = inflater.inflate(r.layout.bay_items, parent, false); txtbarcode = (textview) itemview.findviewbyid(r.id.barcodelbl); txtbarcode.settextcolor(color.blue); txttime = (textview) itemview.findviewbyid(r.id.timelabel); txttime.settextcolor(color.blue); if (result.get("warehouse").tostring().equals("1")) { view warehouse = itemview.findviewbyid(r.id.bayscan); warehouse.setbackgroundcolor(color.yellow); } if (result.get("unknown").tostring().equals("1")) { view warehouse = itemview.findviewbyid(r.id.bayscan); warehouse.setbackgroundcolor(color.red); txtbarcode.settextcolor(color.white); txttime.settextcolor(color.white); } txtbarcode.settext(result.get("barcode").tostring()); txttime.settext(result.get("time").tostring()); return itemview; }
i'm not sure if understand question correctly describe it, think need locate r.layout.bay_items xml file , add radion button there. although doesn't make sense add 1 radio button, perhaps mean checkbox or that.
Comments
Post a Comment