Insert data into firebase database in android || how to insert data in firebase database android #2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello there and welcome back in this video we're gonna see how to insert data into a firebase database and in our last video if you remember we saw how to connect a firebase database into your Android application and in today's video I'm gonna see how to insert data into the database that we have already created now let's get back to Android studio and as you can see I have already created a layout a pretty basic one with feels like name age etc you can also see ID that I've given to each one and I've also do have a submit button down there this was indeed created using XML in case if you're still wondering and and this is the Java file it's called data insert right after that we are specifying name for our fields here very quick and edit text for fields and button for our button I'm just providing some names here so that I can use this to refer to our actual layout that I've created earlier now you can use a fine view by ID function to point each variable to our field and just like this by the way I feel free to pause this video and if you want to check out the code I'm doing it very fast I hope you can follow along and now let's create another reference variable here to connect to our database and you can see you can use the firebase database get instant start get reference and pass the name of our table and this is used to refer our database in the firebase cloud so the name that you give here will be taken out the name of our tree or you can also call that a table now let me create another Java class and this time I'm calling a member since our table name is member and here we are going to define our variables and their type so that we can receive values to these variables and send them into our database okay that's very easy what I'm doing here is that I'm just defining the types of the variables that we are going to use so that I can receive values to these variables and I can send them into the database now right click and click on us generate a setter and getter now why we use a setter and getter this might be one of the question that you are having right now now what we use this like I said before we use those functions to send data into our database and actually we are we have to obtain the value that we are entering into the fields so that's what we're exactly doing with seller and getter via are actually receiving those data that we enter into the layout and we are receiving them using the setter and getter function and then we are putting them into the variable that we have already mentioned above and then we pass them into your real database that's how this thing is going to work now here I'm really creating set on click event listener so when you click the button and it will send all these data to the variables that I've already mentioned in my other Java file so like I said before feel free to pause because I'm doing it very quick for the sake of the length of the video just like that now let me create a member of jekt and you think that member object I'm going to send each type of data to these variables okay this is very easy you and I'm using push set value and defining our table name that is the member so what happens is that when you click the button and if everything is successful then it will also show this just that I'm waiting right now like we did in our last video now let me run the emulator see if my code works okay my system kind of slow I guess okay now this is a wrap you know let me provide some nellie's blah blah blah now if you check our database in the cloud that you can see that all the style that I've given or started to appear in our database in the cloud and this is how it works let me provide another one real quick okay you can also see the choice method I have created now okay if you expand that you can see the values just like that now let me delete these values and I'll show you another thing in a moment let me delete them real quick this time I'm adding an extra line of code let's place a child here and see what happens just like then I am going to name that member one less emulate our code okay okay now put it out oops well let me get back to the emulator yeah okay now I'm going to put some value in here all right I know yeah you can see that the value started to show up in your club but this time you can see that beneath the member tag there is another tag called member one and that's because we added that child and our code right there okay that for this video hope you find it useful and feel free to ask questions and also if you liked the video hit that like button and also do subscribe to my channel and I really appreciate that and thank you very much again and I will join you later
Info
Channel: Educatree
Views: 138,344
Rating: undefined out of 5
Keywords: how to insert float value in to firebase database, how to insert Long integer in to firebase database, simple method to insert data into firebase, insert into firebase database android, insert data into firebase database, insert data in to firebase database, insert data into firebase database android, how to insert data in firebase database android, How to insert data into firebase real time database in android, how to insert data in firebase database, add data to firebase android
Id: iy6WexahCdY
Channel Id: undefined
Length: 7min 47sec (467 seconds)
Published: Thu Dec 27 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.