I'm trying to use RecyclerView in Android Studio and getting this error E/RecyclerView: No adapter attached; skipping layout

Viewed 8
add.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                System.out.println("pressed");
                if (selectedRadioButton() == R.id.RB_byAmount){
                    setTransactionsByAmount();
                }else if (selectedRadioButton() == R.id.RB_byDate){
                    setTransactionsByDate();
                }else if (selectedRadioButton() == R.id.RB_byID){
                    setTransactions();
                }else {
                    System.out.println("its wrong");
                }
                MyAdapter1 adapter = new MyAdapter1(GetTransaction.this,transactions);
                RecyclerView rv = findViewById(R.id.RV_get_show);
                rv.setLayoutManager(new LinearLayoutManager(GetTransaction.this));
                rv.setAdapter(adapter);
            }
        });

This is the only place in my code that I'm using RecyclerView but it doesn't seem to show the results on my screen and I think its because of the error I keep getting: E/RecyclerView: No adapter attached; skipping layout. Any suggestion on how to fix this?

0 Answers
Related