New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add nodes dynamically from firebase #34
Comments
@deeppomal, you have too loop throw |
Okay so I made an arraylist of all FamMember objects and looped through it to find the parent of first generation which will have getParent value = "null" and if its getChildren is not null then it will display the children ( as code given below). Now this will only display first generation. Now how to display children of further generations. Like to add an edge the first argument should be compile time declared variable right? eg : Node node1 = new Node(Parent); for(int i =0;i<famMembers.size();i++) {
|
You are still not looping through your children. All you do is finding your first generation of parents and adding their children as a node. |
@deeppomal this can be achieved by recursion. |
@GregorBlock Yes, implemented. |
I am trying to dynamically create a graph with each node displaying the event name.
However the app crashes and the following error shows up in the logcat java.lang.NullPointerException: Attempt to invoke interface method 'de.blox.graphview.Graph de.blox.graphview.GraphAdapter.getGraph()' on a null object reference |
It's a bug. Put the adapter initialization out of the callback directly after the findViewById and set the graph with adapter.setGraph() |
I put the initialization outside the call back and set the adapter outside it. It worked. |
Tried this but app crashes. I also want to add mulitple child nodes to a parent and I cant guess how to do that dynamically.
databaseReference = FirebaseDatabase.getInstance().getReference("family_members/");
databaseReference.addValueEventListener(new ValueEventListener() {
@OverRide
public void onDataChange(DataSnapshot snapshot) {
The text was updated successfully, but these errors were encountered: