Currently, I am trying to develop an app that invites people to an event using firebase.
I have been using arraylist to set invited peoples' list like this:
friend_list = data.getStringExtra("friends_list");
friend_array = new ArrayList<String>(Arrays.asList(friend_list.split(",")));
newEvent.child("invited").setValue(friend_array);
Doing so, set the values on the Database like this:
invited:
0: "JohnDoe1"
1: "JohnDoe2"
2: "JohnDoe3"
3: "JohnDoe4"
However, I need it to be set like so:
invited:
JohnDoe1: true
JohnDoe2: true
JohnDoe3: true
JohnDoe4: true
Is there a way to maybe loop it so it becomes set like this? Thanks in advance.