I'm beginner on Android and I'm looking for a way on how can I check if a username exists already in Parse data class(User) in Android.
btnreg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ParseUser user = new ParseUser();
user.setUsername(etmail.getText().toString());
user.setPassword(etpwd.getEditableText().toString());
user.put("nom_prenom", etname.getText().toString());
user.put("tel", ettel.getText().toString());
user.put("adresse", adresse.getText().toString());
user.put("sexe", spsexs.getSelectedItem().toString());
user.put("annee_naissance",spnaissance.getSelectedItem().toString());
user.put("ville", spville.getSelectedItem().toString());
user.signUpInBackground(new SignUpCallback() {
public void done(ParseException e) {
if (e == null) {
// Show a simple Toast message upon successful registration
} else {
alerte("Oupss!!", "Error..." + e.getMessage(), 0);
}
}
public void done(com.parse.ParseException e) {
alerte("Succes", "Inscription terminée..", 1);
}
});
I want to check if a username exist in parse : if it exist i want to show an error or a message ("username already taken").
Why do you want do to this ? parse will do that itself for you.
You can track this using ParseException object that you get in SignUpCallback's done method.
Try to get message of that ParseException.