Retrieve firebase ID in a ListView

0

I'm trying to retrieve the id from firebase in my android project. I'm starting to work with firebase now and I do not know much. It's kind of different from Parde where he already shows me the ID. Does anyone know how I get the firebase id? In the parse I created the fields and it already returned the ID in the firebase I can not recover.

It shows the correct list, but I want to get the id to pass to a new intent.

    
asked by anonymous 04.11.2016 / 11:29

1 answer

4

Firebase is not a relational database, so it does not have an "id" that is needed to make relationships.

Being a non-relational database of type Documentary your identifier is the "key" in the case item1 for example.

A documentary database should contain all the data needed for its operation, so an ID would not be necessary since this field would not be referenced by anything.

In the example below:

"lutadores": {
    "blanka": {
        "magia":"Electric Thunder"
    },
    "ryu": {
        "magia":"Hadouken"
    },
    "sagat": {
        "magia":"Tiger Uppercut"
    }
}

When requesting the Firebase the Json fighters, I will have the following JSON:

{"blanka":{"magia":"Rolling Attack"},"ryu":{"magia":"Hadouken"},"sagat":{"magia":"Tiger Uppercut"}}

If you want a specific object, I can request the object by passing its key: /lutadores/blanka.json will return: {"magia":"Rolling Attack"}

These examples have been taken from the CDG White Duck , there are some cool examples there.

In this link has a comparative on the types of NoSQL banks and their advantages / disadvantages.

    
04.11.2016 / 11:52