Firebase Realtime Databae Not Working, Setvalue
I made sample by tutorial 'https://firebase.google.com/docs/database/android/start/?hl=ko' for Firebase realtime database But I cannot see any data after onDataChanged 'EventValue
Solution 1:
this example will insert new user data in firebase db.
FirebaseDatabase database;
DatabaseReference usersTable;
database = FirebaseDatabase.getInstance();
usersTable = database.getReference("Users");
/*we work here */
usersTable.addValueEventListener(newValueEventListener() {
@OverridepublicvoidonDataChange(DataSnapshot dataSnapshot) {
progressDialog.dismiss();
if (dataSnapshot.child(phoneEditText.getText().toString()).exists()) {
Toast.makeText(SignUp.this, "Number already register", Toast.LENGTH_SHORT).show();
}else{
Usersusers=newUsers(nameEditText.getText().toString(),passwordEditTex.getText().toString(),phoneEditText.getText().toString());
usersTable.child(phoneEditText.getText().toString()).setValue(users);
Toast.makeText(SignUp.this, "Signup Sucessfully", Toast.LENGTH_SHORT).show();
finish();
}
}
@OverridepublicvoidonCancelled(DatabaseError databaseError) {
}
});
hope this will help you
Post a Comment for "Firebase Realtime Databae Not Working, Setvalue"