You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a problem in our project with this fix. When we create our adapter which extends FlexibleAdapter we display empty view because initially number of items equals to 0. However, as soon as we add our empty view this function gets called again because it's not aware our empty view is just a dummy placeholder and not the real item.
The result is that this function never gets called again. Before this fix we used to have the following and it was working great because onUpdateEmptyView was fired multiple times as items were added to the adapter:
@Override
public void onUpdateEmptyView(int size)
{
int emptyItemCount = getItemCountOfTypes(emptyViewRes);
if (size == 0)
{
EmptyItem emptyItem = new EmptyItem(emptyViewRes, emptyViewText);
addItem(0, emptyItem);
}
else if (size > emptyItemCount && emptyItemCount > 0)
removeItemsOfType(emptyViewRes);
}
Ok, the "issue" was on our end because our empty view was actually an item with a special type and not separate view in the layout. We've fixed our issue by manually calling onUpdateEmptyView from within data observer we registered when creating our extended adapter.
Now
onUpdateEmptyView()
is called if initial count is different from the finalgetItemCount()
. It should be called based on the following changes:The text was updated successfully, but these errors were encountered: