Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Joseph Wagner
.a{fill-rule:evenodd;}techdegree seal-36
Joseph Wagner
Android Development Techdegree Graduate 27,137 Points

Firebase - Reading Data

My data structure:

I'm having trouble reading values from Firebase. If I delete the timelog child then it seems as if Users is the root of the datasnapshot and it will function if I remove users like this:


I keep getting a null pointer exception if I try to access like I'm currently doing. How can I access the values from TimeLog?

Here's the data structure. data structure

private void showData(DataSnapshot dataSnapshot) {
        for(DataSnapshot ds : dataSnapshot.getChildren()){
            UserInfo uInfo = new UserInfo();

            String firstName = uInfo.getFirstName();
            welcome.setText("Hello there " +firstName);