Stuck Yet Again! 77 of 100 Days of Code
I finished the new tutorial, but my screen is blank!
You can find a video of this at the bottom of the page and a link to the source code here.
I finished the newest tutorial I found for populating a ListView using Firebase. But now my app screen is blank.
I went back and added comments to the MainActivity for the steps I followed thus far. I confirmed the DatabaseReference object was properly instantiated so the app could pull data from the database (click below).
I included the comments in order to document the process I’ve followed thus far. Often times code can be tricky to remember. By including the steps, I can quickly remember how to perform these tasks.
After this, I added a ChildEventListener to the DatabaseReference object. I overrode the onChildAdded and onChildChanged methods to add entries from the database to the ArrayAdapter, and update with dataset changes respectively (click below).
The ChildEventListener would allow the app to update the displayed information whenever a change is made to the Realtime Database. This way I don’t have to keep changing the app whenever I update the database on the back end.
Once this was complete, I set the adapter for the ListView and rebuilt my app. Setting the adapter was necessary in order to display the ListView. But for some reason, after I finished, the app’s screen was entirely blank (click below).
I can’t seem to catch a break with these tutorials. At least this time I didn’t have any compiler errors at the end.
Next time I’ll review the code thoroughly and compare to the tutorial to ensure everything is as it should be. If this doesn’t work, I’ll just have to find another tutorial, again.
Join the mailing list to see updates like this every week!
Coding Fanatic