equitharn equitharn - 1 year ago 111
Android Question

recyclerview No adapter attached; skipping layout

just implemented Recyclerview in my code, replacing Listview.

everything works fine. The objects are displayed.

but logcat says

15:25:53.476 E/RecyclerView﹕ No adapter attached; skipping layout

15:25:53.655 E/RecyclerView﹕ No adapter attached; skipping layout

for the code

ArtistArrayAdapter adapter = new ArtistArrayAdapter(this, artists);
recyclerView = (RecyclerView) findViewById(R.id.cardList);
recyclerView.setLayoutManager(new LinearLayoutManager(this));

as you can see I have attached an adapter for recycleview.
so why do i keep getting this error?

i have read other questions related to same problem but none helps.


Can you make sure that you are calling these statements from the "main" thread (for example inside the onCreate() method). As soon as I call the same statements from a "delayed" method. In my case a ResultCallback, I get the same message.

In my Fragment, calling the code below from inside a ResultCallback method produces the same message. After moving the code to the onConnected() method within my app, the message was gone...

LinearLayoutManager llm = new LinearLayoutManager(this);
list.setAdapter( adapter );