设置Firebase数据库时出错

时间:2017-01-28 11:31:26

标签: android firebase firebase-realtime-database firebaseui

我有以下结构:

enter image description here

如何使用FirebaseListAdapter在Discussion对象中显示这两个问题?以下代码未给出预期结果

FirebaseDatabase database = FirebaseDatabase.getInstance();
DatabaseReference myRef = database.getReference("Discussion"); 
myAdapter = new FirebaseListAdapter<String>(this,String.class,android.R.layo‌​ut.simple_list_item_‌​1,myRef) { 
  @Override 
  protected void populateView(View view, String s, int i) { 
    TextView text = (TextView) view.findViewById(android.R.id.text1); 
    text.setText(s); 
  } 
}; 
GridView gv = (GridView) findViewById(R.id.gridView); 
gv.setAdapter(myAdapter);

0 个答案:

没有答案