I was trying to get some data from my Firebase realtime-database as followed generally, but I couldn’t figure out where in the code the problem was. The code is attached: I also use getter: database image here xml all allmedicine find_medicine xml Answer Change your query to – And according to firebase doc – The class has an empty constructor,
Tag: firebase-realtime-database
How to retrieve data from Firebase database and show the values in Google map?
In my database, I have values about location for each persons like that database structure and I want to retrieve data and show in the map. How get get and show? I created an ArrayList and details class constuctor for get a values. Answer To solve this, please use the following code: But I strongly recommend you, to store the
getting firebase ServerValue.TimeSTAMP in wrong format, how to convert to Date?
I want to get Firebase Server current time, i searched stackoverflow, i found method ServerValue.TIMESTAMP and it’s returning value when i debugged .sv=timestamp i am getting above String, but can’t figure out how to convert it to date. I also tried getting it in hashmap, can somebody please help on this. Note: i haven’t stored date in firebase. Answer this
How to get children keys from Firebase without downloading their children?
I have a Firebase database with a node “items” that has many children and I would like to import a list of the children keys. Since each child contains quite some data that I am not interested in for this purpose, I would like to download only the children keys (to minimize the amount of data transferred). For illustration, suppose
Best practice for using generics with Firebase snapshot.getValue()
TL;DR: How to correctly use a generic class with Firebase DataSnapshot.getValue()? Use case: I want to implement a single generic remote datasource class for all my entities (a bunch of them) using Firebase. When listening to data change, I want to get the values from datasnapshot as an object of type E (its type determined elsewhere) but I don’t know
Handling positions in FirebaseRecyclerAdapter
I have fiddled with the FirebaseRecyclerAdapter for quite some time now. It’s really a great tool to populate a custom list/recycler view very fast with all of its features. However, one thing that I would like to ask is how to handle positions of items inside the adapter itself. So for example, I want to mimic this small feature that
Java Get Value from Object by Key Name
I have retrieved an object from Firebase and would like to access the values of it using the name of each field I would like the value for. In javascript, this would be something as simple as myObject.name to retrieve the name in the object. How can I do the equivalent in Java? Answer Try this: If you have a
Where can I get “serviceAccountCredentials.json” for Firebase Admin?
Here is said what I need to set up Firebase on java: But where can I get serviceAccountCredentials.json ? UPDATED: I found that this file seems should have this fields, but where get this values? Answer Found details about this in this link [UPDATED 30.11.2021] To generate a private key file for your service account: In the Firebase console, open
Firebase for Android, How can I loop through a child (for each child = x do y)
This is what my test looks like: I won’t use the fields above, it’s just a dummy. But I would like to go through all the children on “users” and for each email return a: The only way I found of listing an object is using firebaseAdapter, is there another way of doing it? Answer The easiest way is with