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:
try swiping up/down (then see next element on next screen, because take whole screen). in case,
r.layout.xyz
has root viewandroid:layout_height="match_parent"
, should changeandroid:layout_height="wrap_content"
try swiping left/right (probably see next element on left/right of current). check in layout haven't specified
android:orientation="horizontal"
recyclerview.
Comments
Post a Comment