Recover firebase ID on a Listview

Asked

Viewed 730 times

0

I’m trying to recover the firebase id on my android project. I’m starting firebase now and don’t know much. It’s kind of different from Parde where he already shows me the ID. Does anyone know how to get the firebase id ? In the parse I created the fields and he already returned me the ID in the firebase could not recover.

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

Lista Firebase

Firebase no Android

1 answer

4


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

Being a Nosql (Nonrelational) database of type Documental your identifier is the "key", in case item1 for example.

A documentary database should contain all the data necessary for its operation, then it would not be necessary an ID because 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 I request Json fighters from Firebase, 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 were taken from CDG Pato Branco, have some pretty cool examples there.

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.