arraylists
使用单个
valueEventListener
.
这是我的火力基地。
这就是我所做的。
ValueEventListener allCodesListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
// This method is called once with the initial value and again
// whenever data at this location is updated.
for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
CouponObj post = postSnapshot.getValue(CouponObj.class);
list.add(new CouponObj(post.getCode(), post.getDetail(), post.getExpirationDate(), post.getLikes(), post.getStatus(), post.getSuccessRate(), post.getUsers_today()));
Log.e("Get Data", post.getCode());
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
};
myRef.child("allcodes").addValueEventListener(allCodesListener);
在这个
listener
我只有孩子
allcodes
. 现在我可以重复上面的代码,再做一个监听器,让
more_apps
但我想知道有没有更好的办法。
,上有多个节点
firebase
arraylist
把它们储存在
sqlLite
,为此我必须写很多听众。问题是有两个以上的节点及其子节点。我想一次搞定他们,在单人房里
.