SwipeStack
SwipeStack copied to clipboard
SwipeStack doesn't respond with the update in the list associated with the adapter of it.
I want the list of items to be changed dynamically. So when the list of items are changed, the swipe stack doesn't take effect instantly. When the number of items in the list is changed, notifyDataSetChanged is called on the adapter associated with it. But it doesn't take effect in the swipe stack. It doesn't update the stack as per the change in adapter.
Same problem here.
Thanks, @comeondude @trramsiq ! I will look into this :wink:
i don't know if what i'm doing is similar to this, but if i remove an item from my list onViewSwipedToRight or onViewSwipedToLeft, i get an IndexArrayOutofBounds exception
In my case, it is sufficient to change the adapter base class from BaseAdapter to ArrayAdapter or another providing a concrete implementation of notifyDataSetChanged(). If you don't want to change the Adapter base class, just override the notifyDataSetChanged() to add the new data to the adapter data. This solved the problem for me, hope it helps.
Maybe @flschweiger could change the sample application provided with the library to reflect this?
`MySwipeStackAdapter
public class MySwipeStackAdapter extends ArrayAdapter<String> {
private List<String> mAdapterData;
public MySwipeStackAdapter(Context context, int resource, List<String> data) {
super(context, resource, data);
mAdapterData = data;
}
@Override
public int getCount() {
return mAdapterData.size();
}
@Override
public String getItem(int position) {
return mAdapterData.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = getLayoutInflater().inflate(R.layout.my_card, parent, false);
}
TextView textViewCard = (TextView) convertView.findViewById(R.id.text_on_the_card);
textViewCard.setText(mAdapterData.get(position));
return convertView;
}
}`
Hi, is this issue will be fixed?
Same problem. I could call resetStack but this will re-attach all views , which is expensive operation
@flschweiger any update about this?