Use 2 child in firebase - android

Can I retrieve this two in one call?
I am planning to compare their "Amount" in the graph inside android studio

Related

Android Studio Kotlin Firebase how to store same child name

Sample
How did I can store same child name without update it?
I want have two Testing3 in Voucher.

Retrieve firebase RTDB data into Recycleview in random

How can such scenario be implemented in a social app Android java. I have built my app with Firebase RTDB and I am retrieving the data into a Recycleview using collection.shufflelist too so that I get random data displayed.
How to add another condition to collection.shufflelist(); that will make the latest post show at the top in that same random order but post that are created within the last 24 hours should be randomly placed at the top.
I have tried to use the logic of
reference.child().orderChildBy(timestap).startAt(system.currentTime....).StopAt(1356890000...) but I only saved date into my database in Simple date format, YY-MM-DD.
So I cannot add another node to save timestamps because app already has installs in several users phone changing database structure or adding new nodes/child may affect the app.
My question now on this situation how possible is it to set my random retrieved data to have the latest at the top?

How to Retrieve specific uid key when clicking on recyclerView an object

I have built an android application using firebase database. I have a recyclerView in which i saw some objects. When i click on one of the options i want to get the unique id so later i can change some values.
If it where a user i could get the id by FirebaseAuth.getInstance().getCurrentUser().getUid()
I want something like that but i cannot find it.
For example. I have those two Notifications Objects in the database.
Here when i click on one i need to get the key. I have not added the objects on a list so i can use list.get(position).getId(). Is it possible to get it from getAdapterPosition()?

How do i differentiate between different level of users in firebaseAuth

I have two different types of users Teachers and Students . I use Firebase Auth with Email and password to Authenticate them and store them in the Firebase Real time database . My question is is there a way to create custom accesor methods such as getCurrentUser().getEmail, getDisplayname etc . I need to display different UI for different user type (Teacher/Student) from the current user-type
You got 2 type of users. So first of all, you can make only one firebase structure for both user and just add a boolean variable TEACHER that indicates if a user is a teacher or a student.
But what I usually do is to seperate the users in two different firebase structures meaning that you should create a firebase path teacher/user_id and an another student/user_id which will give you flexibility with retreiving data and display the data in different UI.

How to add users to groups in Firebase?

A newbie Firebase/Android user here, and I am attempting to create an application where users can be added to a group in my Firebase database.
I have defined my User and Group objects as per this post -
Group of users in firebase
My user and group object looks as in the above post and I understand from the documents on Firebase that in order to add a user to a group I need to also add a group reference to a user object but I do not know how I would code this.
I am just unsure of how best to add a User to a Group with Android programatically ,how would I best achieve this?
i think if you familiar with lists you will use it very well as it is very basic one that you have object of group and object of user
and all you want is to access the user and add the group object
like this
user.getGroups().add(group)

Categories

Resources