askerov/DynamicGrid

notifyDataSetChanged() causes item 0 to disappear.

LawrenceStent opened this issue · 0 comments

Somehow caused by notifyDataSetchanged() in DeviceGridAdapter.setDeletevisibility(boolean); This causes the getView of the gridview to iterate through the items inside it.

The getView gets called as such on the item positions, 0-0-1-2. I assume that due to the double call on position 0, the item gets made invisible as items 1-2 are ok.. There could be x items in the grid but item 0 will always disappear.

This bug doesnt occur in debug mode though if notifyDataSetChanged() is iterated through, or given slightly more time than is made available to it at runtime.

What occurs in setDeleteVisibility is that if I want the delete icon to show, I pass the adapter a boolean value, then call notifyDataSetChanged(), in the getView() of the adapter there is a check for whether the delete icon should be shown on the griditem, if it should be removed the first item disappears. And only when onBackPressed() is called again does it get re-shown, but by that time the fragment is closed.