DEV Community

Cover image for How to make an Expandable Recyclerview list and Firebase database-Part 1
Houssem Ben Othmen
Houssem Ben Othmen

Posted on

How to make an Expandable Recyclerview list and Firebase database-Part 1

This is a step-by-step guide for how to create Recycleview expandable list on android studio and to create firebase project using realtime database.

Let’s start with Firebase.

Step 1

Create new project in Firebase

Click on Get Started than add project. A small window will appear; put your project's name then click create project. In the next page, choose your project's app: ios , android or web. In this example, android app is selected.

In order to continue to the next step, a new project on android studio should be created. Fill in the box with the name of package android studio created.

Next, download the json file and follow the instructions.

finally, add the firebase SDK in android studio.

Step 2

Config Rules of Database

Go to the database, choose Realtime database then open rules page.

Two rules will appear : read and write. If you want to read data, you need to change the value of read to true as illustrated below:

Alt text of image

Note : if you want to add data with your application you need to change the value of write to true

Step 3

Creating Data

When you move to the page "Data" you will find a node which contains a reference to your database .

Alt text of image

In order to add a new child, press on the box "+". a new row will appear with two empty text boxes; one for the name and the other for the value. To add a new child, you need to fill in only the name's box and leave the value's box empty then press "+".
Note: in case of filling in the two boxes (name and value), the "+" box will disappear.

Alt text of image

Now, fill in the both boxes .

Alt text of image

Repeat the previous steps until you make a similar database:

Alt text of image

Once done ,move to the next part .

Top comments (0)