Search code examples
android-studiovariablesfirebase-realtime-databasechildren

Firebase Database - Variable Child (Android Studio)


I need help. Is there any way to make a child in the firebase database from android studios with a variable? I want to create a child with text that the user enters into the application and it is saved in a variable. Etc.: mFirebaseDatabase = FirebaseDatabase.getInstance().getReference().child("Users").child(MailVariable) I try this line of code but my app was crash every time. Is there any way? Please answer or refer me to the site where the solution is located. Thank you. (Note: I'm beginner and I'm getting ready for competition)


Solution

  • if your mFirebaseDatabase variable returning an instance of the FirebaseDatabase then that is wrong. Be careful with the return types of the sdks.

    FirebaseDatabase.getInstance().getReference().child("Users").child(MailVariable)
    

    the above will not return a type of FIrebaseDatabase