Retrieve Data from Firebase Realtime Database in Android app Latest Version 2020

so guys today in this video we will talk about how you can retrieve data from firebase database in your android app so lets start as you can see this is firebase realtime database so first of all we will feed some data in database we will create a child after this follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps then click on add button create more subchilds like this follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps now we have added data in database now we will retrieve this data in android app now go back to android studio and this is our app in last video we used edittext and button so i have deleted it make your root layout linear layout and first of all open gradle build and now you have to add some dependencies here and first one is cardview then recyclerview third one is firebase ui database fourth is app compat 28.0.0 last one is material so make sure recyclerview and cardview app compat dependency version should be same otherwise app will crash in run time so lets start we will start from activity xml file now we have added recyclerview dependency so first of all follow steps follow steps follow steps follow steps follow steps now our recyclerview is complete and activity main xml file is complete now we will create a java class its name will be User User after this we will define string variable and make sure it should be same as you have given in firebase database that keys in database we have given gender and name in database so here we have to define same string after this we will create an Empty constructer follow steps after this we will generate getter and setter methods go to generate and click on getter and setter methods select all and then click okk now our user.java class is complete so close it now we will create another java class its name will be Holder because it will hold our data first of all extend this class to recyclerview .viewholder it is showing error it is showing because we have not implemented methods so click on red bulb and choose it now error is gone follow steps follow steps follow steps follow steps follow steps here we will create a method follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps here we will declare variable and give reference follow steps so for this we will create layout file follow steps follow steps its name will be data then ok change its root layout to cardview follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps in this text view our data will show from realtime database follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps our layout file is complete now so go back to holder.java close it make sure you have given ID follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps now our holder.java class is complete now go to mainactivity .java here we will declare variable for recyclerview after this follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps after this we will give database reference follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps and make sure here you have to give same data child name that you have created in realtime database so give same child name here follow steps after this we will use onStart method so when ever activity will start this method will implement so after this so the dependency firebase ui that we have added in our gradle build is for that propose of using Firebase recycler adapter it will show only when you add that dependency if you will not add it so it will show error follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps now we will code inside viewholder method follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps follow steps now our coding is complete let me check why it is showing error something is missing now its fine now there is no error so before running app give internet permission in manifest file or app will crash in runtime so run your app so guys as you can see in our app data is retrieved in next video we will talk about how you can retrieve images with text if you like this video then like share and subscribe my channel Thanks for watching

Loading