I'm recently migrated to Firebase. I have gone through Firebase Android api docs for retrieving data from database through JSON. there is method
From the Firebase guide on reading data:
onDataChange()method is] triggered once with the initial data and again every time the data changes.
I highly recommend that you read the Firebase guide for Android programming end-to-end. It'll answer many of the questions you're likely to have as you start using Firebase.