How to retrieve specific node from firebase database in android

前端 未结 3 1048
臣服心动
臣服心动 2020-12-28 08:36

I am trying to use Firebase in my android application. I am following documentation for Saving and retrieving, But the Sample database(Dragon) which is used in tutorial has

3条回答
  •  轮回少年
    2020-12-28 09:08

    You're creating a query in this line:

    Query queryRef = myFirebaseRef.orderByChild("fullName");
    

    Like that the query orders the child nodes by their fullName value. But it doesn't yet limit what child nodes are returned.

    To limit the nodes, you also have to filter. e.g.:

    Query queryRef = myFirebaseRef.orderByChild("fullName").equalTo("gooner");
    

    You can also get a range of nodes, by filtering with startAt and/or endAt instead of equalTo.

    As Kato commented:

    It looks like there is a superfluous level of children. The data is structured as saving-data/fireblog//fluff/...actual data... and the fluff layer needs to be removed for those queries to work. You can't query children of children.

提交回复
热议问题