Edittext In Listview Gets Duplicated
I know this question is asked many times before and followed them and I am up to the mark to a great extent with only one problem left.I was able to solve the duplicating issue by
Solution 1:
Finally I got it working using Focus Change Listener and adding one more parameter to the existing arraylist. Using another list or Hashmap didn't worked for me. So as suggested by Yazan I added it in my arraylist and is working now. Here is the code what I have now
holder.Cantidad.setText(planmanobraBeanArrayList.get(position).getEditext());
final ViewHolder finalHolder = holder;
holder.Cantidad.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
publicvoidonFocusChange(View view, boolean hasFocus) {
if (!hasFocus)
{
if (!finalHolder.Cantidad.getText().toString().equals(""))
{
planmanobraBeanArrayList.get(position).setEditext(finalHolder.Cantidad.getText().toString());
}else {
planmanobraBeanArrayList.get(position).setEditext("");
}
}
}
});
Thanks for everyone help
Post a Comment for "Edittext In Listview Gets Duplicated"