0
JSONFirebaseRecyclerAdapter只加載1項
{
"Country" :
{
"Cabana" : "Sydney",
"Pub" : "China",
"SkyGarden" : "Indonesia",
"Tito" : "Vietnam"
}
}
主要活動代碼。
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);
回收站查看只顯示1項。姓名+澳大利亞。 如何加載更多項目?
How to Retrieve a List object from the firebase in android
我已經通過這篇文章,甚至Android的聊天應用程序走了,但我無法真正瞭解它。