I'm trying to make an app in which user store his Data. I've used user shared preferences to save user login details but still for security purpose, i made an activity(Verify Passcode Activity) that ask user Passcode to allow access on the data. Now i'm able to save, fetch and delete data. But in my Verify Passcode Activity, i just want to fetch that particular key and value where passcode is stored. I don't want to fetch complete data in Verify Passcode Activity.

Below is the code which i used to save passcode to database:-

```
databaseReference.child(uniqueID).setValue(passcode);

```

Below is the code i'm tried to fetch only passcode:-

```
dbreference.child(uniqueID).orderByChild("passcode").equalTo(pass).addListenerForSingleValueEvent(new ValueEventListener() {
    @Override
    public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
        if (dataSnapshot.exists()){
            Toast.makeText(getApplicationContext(), "Data exist", Toast.LENGTH_LONG).show();
        }else{
            Toast.makeText(getApplicationContext(), "Data doesn't exist", Toast.LENGTH_LONG).show();
        }
    }

    @Override
    public void onCancelled(@NonNull DatabaseError databaseError) {

    }
});

```

Here `uniqueID` is `"abhishek88666kumar"`and `pass` is a variable used for `getText()`.

Here is the screenshot of my Firebase Database :-

[Database Screenshot](https://i.stack.imgur.com/7itFZ.png)

Here is Verify Passcode Activity Screenshot:-

![Verify Passcode Activity Screenshot](https://i.stack.imgur.com/UDg2p.png)

Please have a look at Database Screenshot and Verify Passcode Activity Screenshot.

Agenda:

1. getText() from textView inside activity.
2. getValue from firebase realtime database (only for current user. 'abhishek88666kumar' in our case).
3. compare if 1 and 2 are same or not. (If same then redirect to MainActivity else show error.)

Please tell me what i'm doing wrong.