Closed chundk closed 5 years ago
Exception throws when swapAdapter get called.
IllegalStateException("Observer " + observer + " was not registered.") E
Well, the solution is overriding swapAdapter
@Override public void swapAdapter(@NonNull Adapter adapter, boolean removeAndRecycleExistingViews) { if (getAdapter() != null) { getAdapter().unregisterAdapterDataObserver(mScrollOffsetInvalidator); } if (adapter != null) { adapter.registerAdapterDataObserver(mScrollOffsetInvalidator); } super.swapAdapter(adapter, removeAndRecycleExistingViews); }
I'm not sure what SwapAdapter is, or what circumstances lead to this crash. This seems off topic and related to whatever library SwapAdapter belongs to.
Exception throws when swapAdapter get called.
IllegalStateException("Observer " + observer + " was not registered.") E
Well, the solution is overriding swapAdapter
and copy method of setAdapter, instead of calling super.swapAdapter