I have a RecyclerView
. Data comes from a server. A list item view contains:
- one
TextView
- one
EditText
- one
Button
I have 10 list items. When I click the button data will send to the server, and after successful submission the button visibility is set to View.INVISIBLE. The problem is that every 7th button is also changed to invisible. The data transfer is working properly. Please help me.
Bind the view holder
@Override
public void onBindViewHolder(final ViewHolder1 holder, final int position) {
final Ardlist_item listitem = listitems.get(position);
holder.textitemname.setText(listitem.getItemname());
holder.liftqty.setText(listitem.getQty());
holder.rcqty.setText(listitem.getQty());
holder.b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
holder.b1.setVisibility(View.INVISIBLE);
holder.rcqty.setEnabled(false);
Toast.makeText(context, "clicled" + position, Toast.LENGTH_LONG).show();
}
});
}
Getting the position
@Override
public int getItemCount() {
return listitems.size();
}
public class ViewHolder1 extends RecyclerView.ViewHolder {
public TextView liftqty;
public Button b1;
public EditText rcqty;
public ViewHolder1(View itemView) {
super(itemView);
textitemname = (TextView) itemView.findViewById(R.id.item_name);
liftqty = (TextView) itemView.findViewById(R.id.lifted_qty);
b1 = (Button) itemView.findViewById(R.id.receive_btn);
rcqty = (EditText) itemView.findViewById(R.id.received_qty);
}
}