我使用FirebaseListAdapter并试图获得的从我的火力地堡数据库开放的聊天室的列表,结构非常简单:Android的火力地堡嵌套查询
这是我所得到的,当我查询:
{-KY99IS2mLzayD4HDyd6={location={...}, posts={....} , title="chatname"}
而且我想要做到的,是得到数据,而ID的一部分,所以它会适合我的对象建设者,这样的事情:
{location={...}, posts={....} , title="chatname"}
我知道ChildEventListener
这样做,但我没有选择将它与FirebaseListAdapter一起使用,所以我希望还有另一种方法可以做到这一点。
我的代码是:
FirebaseListAdapter<ChatRoom> firebaseListAdapter = new FirebaseListAdapter<ChatRoom>(this,ChatRoom.class,R.layout.chatslist_row,myRef3) {
@Override
protected void populateView(View v, ChatRoom chatRoom, int position) {
System.out.println(chatRoom.title);
}
};
但它不工作,因为关键部分,它不能使用我的ChatRoom
类对象生成器。
谢谢!
相信我的问题http://stackoverflow.com/questions/40802754/android-firebase-list-data-from-keys/40812418#40812418。 –
@ JohnO'Reilly其实不,它不同 –
我认为是嵌套数据的存在,你必须执行单独的查询来检索....重新阅读你的问题我不清楚如果是这样的话或不是因为你遇到的问题? –