I have created the expandable listview.If i click the plus means that particular child name and count is add into the movielist.The duplicate childname and count is added into the list.I want to add the incremented count value and their name is added into the list.I want to delete the duplicate name and update the count for relevant name`
@Override
public View getChildView(final int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final Child child = (Child) getChild(groupPosition, childPosition);
final Child modelChild = groups.get(groupPosition).getItems().get(childPosition);
viewHolder.plus.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
checkin_layout.setVisibility(View.VISIBLE);
if(modelChild.getCount()>=0) // set your count default 0 when you bind data initially
{
int count = (modelChild.getCount()) + 1;
modelChild.setCount(count);
count1=count1+1;
// int s= Integer.parseInt(itemname.getText().toString());
// Log.d("s--", String.valueOf(s));
// count1=s+count1+1;
itemname.setText(Integer.toString(count1)+"items");
// viewHolder.txtView.setText(Integer.toString(count1)+"items");
Detailpage.item.setText(Integer.toString(count1)+"items");
int total = 50 * child.getcount();
String name = modelChild.getName();
Movie movie = new Movie();
movie.setcheckin_name(name);
movie.setcheckin_count(Integer.toString(total));
movieList.add(movie);
HashSet hs = new HashSet();
hs.addAll(movieList);
movieList.clear();
movieList.addAll(hs);
movieList.add(movie);
}
// set your other items if any like above
groups.get(groupPosition).getItems().set(childPosition, modelChild);
notifyDataSetChanged();
}
});
`