Recyclerview No adapter attached skipping layout

0 votes

I replaced ListView with RecyclerView in my code. Everything works fine but an error message is shown.

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

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

Code:

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

Why do I keep getting this error?

Apr 28, 2022 in Other DevOps Questions by Kichu
• 19,050 points
8,830 views

1 answer to this question.

0 votes

Check if you are calling these statements from the "main" thread outside of a delayed asynchronous callback.
Call the code below in your fragment from inside a ResultCallback method. 

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

Move the code to the onConnected() method within my app. 

I hope this helps.

answered Apr 29, 2022 by narikkadan
• 63,680 points

Related Questions In Other DevOps Questions

0 votes
1 answer

This application has no explicit mapping for /error

One of the reason this error coccured ...READ MORE

answered May 2, 2022 in Other DevOps Questions by narikkadan
• 63,680 points
20,277 views
0 votes
0 answers

Bus Seating Arrangement same as in RedBus, Android

I'm attempting to develop a bus seat ...READ MORE

Nov 23, 2022 in Android by Edureka
• 13,620 points
1,036 views
0 votes
1 answer

Running docker on Android

According to the documentation, the Android kernel is ...READ MORE

answered Aug 1, 2018 in Docker by Kalgi
• 52,350 points
3,724 views
0 votes
1 answer

Task Canceled Exception while invoking AWS Lambda

I'm guessing either the TaskCanceledException instance is ...READ MORE

answered Sep 19, 2018 in AWS by Priyaj
• 58,100 points
2,436 views
0 votes
1 answer

Is there a way to run Python on Android?

YES! An example via Matt Cutts via SL4A -- "here’s ...READ MORE

answered Sep 19, 2018 in Python by Priyaj
• 58,100 points
990 views
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP