0

I am fetching images from firebase into RecyclerView in Main2Activity . The follow error is happening

10-19 14:23:33.774 26270-26270/? E/waliwallpapaer: Unknown bits set in runtime_flags: 0x8000
10-19 14:23:38.993 26270-26270/com.ashishapps.android.diwaliwallpapaers E/RecyclerView: No adapter attached; skipping layout
10-19 14:25:39.582 26270-26270/com.ashishapps.android.diwaliwallpapaers E/ViewRootImpl@e3bf762[Main2Activity]: Surface is not valid.

I cant find what am doing wrong i have attatched the adapter still error is showing

the code given below is in the onCreat Method of the Main2Activity`

 databaseReference.addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
        /////getting data out of node]
            for(DataSnapshot postSnapshot:dataSnapshot.getChildren()){
                CardActivity item= postSnapshot.getValue(CardActivity.class);
                cardActivityList.add(item);
                Log.d("MeraLog", "Value is: " + item.toString());
            }
            ///
            adapter= new ImageAdapter(Main2Activity.this,cardActivityList);
            recyclerView.setAdapter(adapter);
        }

        @Override
        public void onCancelled(DatabaseError databaseError) {
            Toast.makeText(Main2Activity.this,databaseError.getMessage(),Toast.LENGTH_SHORT).show();
        }
    });
Ivan Wooll
  • 4,145
  • 3
  • 23
  • 34
Ashish
  • 35
  • 6
  • Does this answer your question? [E/RecyclerView: No adapter attached; skipping layout -- when making a todo list app](https://stackoverflow.com/questions/58034951/e-recyclerview-no-adapter-attached-skipping-layout-when-making-a-todo-list) – Sammy T Oct 19 '20 at 09:51
  • following the answer in the mentioned link causing null pointer exception error in adapter get size() method – Ashish Oct 19 '20 at 12:21
  • Using that method, the List member variable inside your Adapter class has to be initialized when set. ex: `private ArrayList myList = new ArrayList<>();` And you have to make sure that you're null checking new values when you update it. – Sammy T Oct 19 '20 at 19:48
  • Or you can use the method shown in the duplicate. – Sammy T Oct 19 '20 at 19:48

0 Answers0