How to DELETE data from FIREBASE database from Sketchware app?

If you have an app which displays data from firebase database in a custom ListView, and you want to delete data from it, then follow this method.

This method of deleting data is for apps which push data to firebase database on button click by using blocks as shown in image below,
retrieves data from firebase database, on Firebase DB onChildAdded event, by using blocks as shown in image below,

In order to delete data from this kind of app follow the steps given below.

1. Add a new String list str.

2. In the CustomView, add an ImageView imageview2 and set it's image to delete icon. On clicking this ImageView the item will get deleted.

3. In Firebase DB onChildAdded event, inside Firebase DB... get children to List Map... then block,
add the block
Add [childKey] to List String [str],
as shown in image below.

This will create a list of keys or children at the DatabaseReference 'Chat'.

4. In the event onBindCustomView add the block
When [imageview2] clicked,
Inside this use blocks to delete key at that position in FirebaseDB and delete data at that position in String list:
FirebaseDB Chat delete key [get at (position) of List String (str)],
delete at (position) of List str.

If the app is using Firebase Storage to store images and push the url of images to FirebaseDB using blocks as shown below,

Then to delete the image alongwith the message, in onBindCustomView, inside When imageview2 clicked, alongwith the blocks shown above, use following blocks:
If (ListMap [map1] contains at (position) key [image]) then,
FirebaseStorage [fstore] delete file url (get value at (position) key [image] of ListMap [map1])

5. Add a new event Firebase DB onChildRemoved and there add the blocks to retrieve data from Firebase to MapList and display it in ListView, as shown in image below.

6. Save and run the project. Wait for the app to load data from firebase database. After that if you click inageview2 at any position in the list, data at that position in database will get deleted.

Watch the video below:


  1. Thank you.. so much...
    i hope more tutorials to come

  2. Cara ini berhasil untuk menghapus tetapi untuk aplikasi saya yang terhapus malah list bagian yang paling atas/pertama

  3. This comment has been removed by the author.

  4. Hi, thanks for this website,
    Thus, when I try to implement this, I get an error compiling :
    Listview1Adapter cannot be resolved to a type.
    Where am I wrong?

    1. My solution is here

  5. Maybe you have not added listview1 onBindCustomView event.

  6. I have implemented firebase for my app using topics I found here. I can add and delete records, but I really like to figure out how to update a record. Does anyone have an example on how to do this?

  7. How to save ,reterive and edit the data to firebase.simply, not in listview.means to say data is fixed in numbers(not unlimited)

  8. You can follow this

    and this

    to understand how to edit data in Sketchware.

    1. I tried your video about using firebase on name, english , science and such. It was doing great at first. But when I tried to save the data, it will not publish on the main xml, I cannot view the display custom. Please help me how to fix it.

  9. sanjeev, i am working on app Water Quality Results. I want to show result when user enter an id. The result will retrieve/fetch from firebase database. Please help me.

  10. Greetings all.
    I'm developping an app but i'm facing a problem with user data.
    I'm using firebase and i wish to know how one user's datab is differentiated from another. Because i'm afraid when users will edit the data to database from the app, one user's info will delete another.
    I'm asking this because I want my app to have client space in such a way that each client has his personal infos! Help please

  11. How to Retrieve customer details using customer id from firebase database.

  12. Hi. My app view error when i click on the delete icon. Error message:
    Invalid list operation: Invalid index 14, size is 0.
    I dont have a sending images.

  13. Hello how can i fix it. I get invalidlist operation
    :Invalid endex, 0 size is 0

  14. Dear sir, if i create an app and login through firebase. And i wany to show users Name on the screen.
    How can I fetch users name from firebase of particular users??
    Please solve this .. i got stuck over here.

  15. Storage uri cannot contains a path element ??

  16. i got this error from Firebase DB component : Error Code = 3, Error Messages = Permisiion Denied...

    I already set the database console to allow everyone to read/write


Post a Comment

Popular posts from this blog

Create Music Player app in Sketchware

A Flash Light App in Sketchware

In Sketchware: How to create a calculator for any simple formula?

Firebase auth in Sketchware for Login Activity

Simple car racing android game in Sketchware