0

I'm creating a recyclerView using FirestoreRecyclerAdapter, in which I want to search for an email in my firestore using an EditText. If the email exists in firestore, a cardview should appear in my recyclerView with the user's name and if not it should print out "no data found".

But for some reason, the methods onBindViewHolder, onCreateViewHolder and AddUserViewHolder is not called. I see that I receive this error message:

E/RecyclerView: No adapter attached; skipping layout

for the following code:

private void InitRecyclerView() {
    recyclerViewAddUser = findViewById(R.id.userRecyclerView);
    recyclerViewAddUser.setHasFixedSize(true);
    recyclerViewAddUser.setLayoutManager(new LinearLayoutManager(UserToProject.this));
    recyclerViewAddUser.setAdapter(adapter);
    recyclerViewAddUser.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {
            closeKeyboard(view);
            return false;
        }
    });
}

As you see I’ve attached the adapter for my recyclerwiew, so I don’t know why I get this error.

Hope this makes sense, please reach out if it doesn't. Thank you in advance.

Aki
  • 13
  • 4
  • That's a lot of code. Please edit your question and isolate the problem, in that way you increase your chances of being helped. – Alex Mamo Oct 27 '20 at 10:35
  • I dont know where the problem is, so i cant isolate it. – Aki Oct 27 '20 at 11:28
  • This could have many causes, I have found this [old community question](https://stackoverflow.com/questions/28992929/recyclerview-not-calling-oncreateviewholder-or-onbindview/33078107) that has a similar problem and multiple solutions are offered. Try out the solutions offered in there and if the none of them work, and you gained a bit more clarity on what could be causing the issue, edit your question with the isolated problem. – Ralemos Oct 27 '20 at 14:45
  • Just guessing, adapter might be null when it is attached. – palindrom Oct 28 '20 at 09:44
  • I'm calling the function in onCreate, and the adapter is initialized in my searchEmail() function which is called in a setOnClickListener method. – Aki Oct 28 '20 at 09:49
  • Everything appears to be in order with the code you shared so I would say that you should contact [Firebase Support](https://firebase.google.com/support/troubleshooter/contact) to help you with that, since they might be able to have a better insight on what is causing this. – Ralemos Oct 30 '20 at 14:33

0 Answers0