java - ListView with two adapters -
i'm developing whatsapp application received messages aligned left e sent messages aligned right.
how should use listview , adapters keep both received , sent messages in same listview?
i suggest create message class. class has 1 boolean example boolean sent;
so if it's true know sent you.
when create custom adapter list view, do:
public view getview(int position, view convertview, viewgroup parent) { layoutinflater inflater = (layoutinflater) getcontext() .getsystemservice(context.layout_inflater_service); convertview = inflater.inflate(r.layout.rowcustom, null); message msg = getitem(position) if (msg.issent()) { // message sent } else { // message received } return convertview; }
Comments
Post a Comment