Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
389 views
in Technique[技术] by (71.8m points)

java - E/RecyclerView: No adapter attached; skipping layout (HELP)

i'm building my first ever app in Android Studio. The purpose of the app is to connect to my Drupal website API and take data from it.

I have no visisble errors in my code but when i use logcat it keeps coming up with the following error:

E/RecyclerView: No adapter attached; skipping layout

This is some of my code:

public class MainActivity extends AppCompatActivity implements ExampleAdapter.onItemClickListener {

public static final String EXTRA_TITLE = "title";
public static final String EXTRA_BODY = "body";
public static final String EXTRA_LINK = "link";


private RecyclerView mRecyclerView;
private ExampleAdapter mExampleAdapter;
private ArrayList<ExampleItem> mExampleList;
private RequestQueue mRequestQueue;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mRecyclerView = findViewById(R.id.recycler_view);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.setHasFixedSize(true);


    mExampleList = new ArrayList<>();

    mRequestQueue = Volley.newRequestQueue(this);
    parseJSON();


}

I already viewed similar questions on Stack but none of them fixed it.

question from:https://stackoverflow.com/questions/65640936/e-recyclerview-no-adapter-attached-skipping-layout-help

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

you don't set mRecyclerView to your adapter

mExampleAdapter.adapter = your adaper


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...