0

I have a model calss which i used to create groups

public class GroupModel {
    String groupId, groupName;
    ArrayList<GroupMember> groupMembersList;

    public GroupModel(String groupId, String groupName, ArrayList<GroupMember> groupMembersList) {
        this.groupId = groupId;
        this.groupName = groupName;
        this.groupMembersList = groupMembersList;
    }

    public String getGroupId() {
        return groupId;
    }

    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }

    public String getGroupName() {
        return groupName;
    }

    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }
}

when i store data using this model all the data stored except groupMembersList i don't know why. I uses following method to store group data

mdDatabaseReference
                .child(getResources().getString(R.string.group_list_child_key))
                .setValue(groupModel).addOnCompleteListener(task -> {//multiple informations in with same user(instertion will add new information)
            {
                if (task.isSuccessful()) {
                    Toast.makeText(this, "Group Created", Toast.LENGTH_SHORT).show();
                    Utils.hideProgress();
                } else {
                    Toast.makeText(this, task.getException().toString(), Toast.LENGTH_LONG).show();
                    Utils.hideProgress();
                }
            }
        });

where the groupModel is the object of above given GroupModel class.

Please suggest me as i am new to firebase.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

0

u dont have setter and getter for that arraylist ..refer this link - Getters and Setters for ArrayLists in Java

unkn0wn95
  • 36
  • 4