I have the same situation with you, display is ok, but error appear in the locat. That's my solution: (1) Initialize the RecyclerView & bind adapter ON CREATE()
RecyclerView mRecycler = (RecyclerView) this.findViewById(R.id.yourid); mRecycler.setAdapter(adapter);
(2) call notifyDataStateChanged when you get the data
adapter.notifyDataStateChanged();
In the recyclerView's source code, there is other thread to check the state of data.
public RecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.mObserver = new RecyclerView.RecyclerViewDataObserver(null); this.mRecycler = new RecyclerView.Recycler(); this.mUpdateChildViewsRunnable = new Runnable() { public void run() { if(RecyclerView.this.mFirstLayoutComplete) { if(RecyclerView.this.mDataSetHasChangedAfterLayout) { TraceCompat.beginSection("RV FullInvalidate"); RecyclerView.this.dispatchLayout(); TraceCompat.endSection(); } else if(RecyclerView.this.mAdapterHelper.hasPendingUpdates()) { TraceCompat.beginSection("RV PartialInvalidate"); RecyclerView.this.eatRequestLayout(); RecyclerView.this.mAdapterHelper.preProcess(); if(!RecyclerView.this.mLayoutRequestEaten) { RecyclerView.this.rebindUpdatedViewHolders(); } RecyclerView.this.resumeRequestLayout(true); TraceCompat.endSection(); } } } };
In the dispatchLayout(), we can find there is the error in it:
void dispatchLayout() { if(this.mAdapter == null) { Log.e("RecyclerView", "No adapter attached; skipping layout"); } else if(this.mLayout == null) { Log.e("RecyclerView", "No layout manager attached; skipping layout"); } else {