1. farhanahmedkhann's Avatar

    I am new to android development, I can read data from firebase db but I can't insert new data into my firebase db.I have also checked the firebase rules. I have added dependencies properly. which is implementation 'com.google.firebase:firebase-database:19.1.0', please let me know where i am wrong, i have checked many examples but do not know why my code is not working
    import androidx.appcompat.app.AppCompatActivity;

    import com.google.firebase.database.FirebaseDatabase;
    import com.google.firebase.database.DatabaseReference;

    public class Register extends AppCompatActivity {

    private FirebaseDatabase fbase;
    private DatabaseReference mref;
    private Button registerbtn;
    private EditText emailtext;
    private EditText password;
    private EditText cpassword;

    protected void onCreate(Bundle savedInstanceState) {
    getSupportActionBar().setTitle("Sign Up");
    fbase = FirebaseDatabase.getInstance();
    mref = fbase.getReference(path: "users");

    emailtext = findViewById(R.id.email);
    password = findViewById(R.id.password);
    cpassword = findViewById(R.id.cpassword);
    registerbtn = findViewById(R.id.button);
    registerbtn.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {


    private void RegisterUser()

    String emailid = emailtext.getText().toString();
    String Password = password.getText().toString();
    String CPass = cpassword.getText().toString();
    String Keys = mref.push().getKey();

    09-22-2019 07:56 AM
  2. hallux's Avatar
    You'd be better off in our developer's section. @B. Diddy can this be moved?
    B. Diddy likes this.
    09-22-2019 09:03 AM
  3. B. Diddy's Avatar
    Done, thanks @hallux!
    hallux likes this.
    09-22-2019 01:31 PM

Similar Threads

  1. I cannot use application Star Walk with Galaxy J6
    By Android Central Question in forum Ask a Question
    Replies: 5
    Last Post: 09-23-2019, 02:40 PM
  2. My music app in vivo v9 is not opening at all after the upgrade has happned
    By Android Central Question in forum Ask a Question
    Replies: 1
    Last Post: 09-22-2019, 07:34 AM
  3. Replies: 3
    Last Post: 09-22-2019, 03:52 AM
  4. different symbols in my notification bar
    By Badattitude156 in forum Samsung Galaxy Note 10 & Note 10+ (2019)
    Replies: 3
    Last Post: 09-21-2019, 10:06 PM
  5. Unable to send Live Pic in KIK PM
    By Android Central Question in forum Ask a Question
    Replies: 2
    Last Post: 09-21-2019, 05:15 PM