Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my array list data
John
John
Jack
Peter
Parker

the repeated names must have different background in the list view

how to do that?

What I have tried:

ArrayList<listitem> data=
(ArrayList<listitem>)bundle.getSerializable("value");

sentItems = data; //names John,John,Jack....

final List<listitem> duplicates = new ArrayList<listitem>();
Set<listitem> listitemSet = new TreeSet<listitem>(new Comparator<listitem>() {
@Override
public int compare(ListItem o1, ListItem o2) {
return o1.getTitle().compareTo(o2.getTitle());
}
});
for(ListItem c : sentItems)
{
if(!listitemSet.add(c))
{
duplicates.add(c);
}
}
Posted
Updated 16-Oct-17 10:46am

1 solution

In your adapter's getView() method, call the converted view's setBackgroundColor() method.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900