android - FirebaseRecyclerAdapter only loads 1 item -


json

{      "country" :   { "cabana" : "sydney", "pub" : "china", "skygarden" : "indonesia", "tito" : "vietnam"  } } 

main activity code.

 mdatabasereference=firebasedatabase.getinstance().getreference().child("country");     recyclerview=(recyclerview)findviewbyid(r.id.recyclerview);     recyclerview.setlayoutmanager(new linearlayoutmanager(this));     firebaserecycleradapter<string, viewholder>adapter= new          firebaserecycleradapter<string, viewholder>(string.class,r.layout.xyz,viewholder.class,mdatabasereference){          @override         protected void populateviewholder(viewholder viewholder, string model, int position) {             viewholder.name.settext("name + "+model);             // viewholder.serial.settext(string.valueof(model.serial));          }     };     recyclerview.setadapter(adapter); 

the recycler view shows 1 item. name + australia. how can load more items?

how retrieve list object firebase in android

i have gone through post , android chat app couldn't understand it.

there common problems: can use incorrect height of row elements , can import project recycler view worked horyzontally. check both of these problems, can:

  1. try swiping up/down (then see next element on next screen, because take whole screen). in case, r.layout.xyz has root view android:layout_height="match_parent" , should change android:layout_height="wrap_content"

  2. try swiping left/right (probably see next element on left/right of current). check in layout haven't specified android:orientation="horizontal" recyclerview.


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -