-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch database
28 lines (26 loc) · 1.57 KB
/
search database
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
private void getUserAnswer() {
FirebaseDatabase.getInstance().getReference().child("Users")
.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
if(snapshot.hasChild("email")) {
String mails = snapshot.child("email").getValue().toString();
if (mails.equals(currentUserMail)) {
if ((snapshot.hasChild("answer")) && snapshot.hasChild("question")) {
userAnswer = snapshot.child("answer").getValue().toString();
currentUserID = snapshot.child("uid").getValue().toString();
String question = snapshot.child("question").getValue().toString();
questionView.setText(question);
} else {
Toast.makeText(ForgotPasswordActivity.this, "You have not set up a security question. Please create a new account.", Toast.LENGTH_LONG).show();
}
}
}
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}