daily pastebin goal
92%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public boolean checkIfUsernameExists(String username, DataSnapshot datasnapshot) {
  2.         Log.d(TAG, "checkIfUsernameExists: check if " + username + "already exists.");
  3.  
  4.         User user = new User();
  5.  
  6.         for (DataSnapshot ds: datasnapshot.getChildren()) {
  7.             Log.d(TAG, "checkIfUsernameExists: datasnapshot: " + ds);
  8.  
  9.             user.setUsername(ds.getValue(User.class).getUsername());
  10.             Log.d(TAG, "checkIfUsernameExists: username: " + user.getUsername());
  11.  
  12.             if(StringManipulation.expandUsername(user.getUsername()).equals(username)) {
  13.                 Log.d(TAG, "checkIfUsernameExists: FOUND A MATCH: " + user.getUsername());
  14.  
  15.                 return true;
  16.             }
  17.         }
  18.         return false;
  19.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top