Look I have my firestore database and I want to check if one of my users documents already has the username that the user typed in into the textview
usersRef = db.collection("users");
userNameTextView = findViewById(R.id.setup_username);
String username = userNameTextView.getText().toString();
Query query = usersRef.orderBy("username").whereEqualTo("username", userNameTextView.getText().toString());
if(query.get().isSuccessful()) {
Toast.makeText( this, "Username is taken...", Toast.LENGTH_SHORT ).show();
}
And this is the database structure just so you know:
But somehow it isn´t working has somebody got an idea ?