Java 类com.parse.SignUpCallback 实例源码

项目:EletroFisio    文件:CadastroActivity.java   
private void cadastrarUsuario() {

        //Cria objeto usuario
        ParseUser usuario = new ParseUser();
        usuario.setUsername(textoUsuario.getText().toString());
        usuario.setEmail(textoEmail.getText().toString());
        usuario.setPassword(textoSenha.getText().toString());

        //salva dados do usuario
        usuario.signUpInBackground(new SignUpCallback() {
            @Override
            public void done(ParseException e) {
                if (e == null) {//sucesso ao salvar
                    Toast.makeText(CadastroActivity.this, "Cadastro feito com sucesso!",
                            Toast.LENGTH_LONG).show();
                    abrirLoginUsuario();
                } else {//erro ao salvar
                    ParseErros parseErros = new ParseErros();
                    String erro = parseErros.getErro(e.getCode());
                    Toast.makeText(CadastroActivity.this, erro, Toast.LENGTH_LONG).show();
                }
            }
        });

    }
项目:ParseLiveo    文件:MainActivity.java   
private void signUp(){
    ParseUser user = new ParseUser();
    user.setUsername(USER_NAME);
    user.setPassword(PASSWORD);
    user.setEmail(EMAIL);
    user.signUpInBackground(new SignUpCallback() {
        public void done(ParseException e) {
            if (e == null) {
                login();
                Toast.makeText(getApplicationContext(), "Login cadastrado com sucesso", Toast.LENGTH_SHORT).show();
            }else{
                Toast.makeText(getApplicationContext(), "Erro ao cadastrar login", Toast.LENGTH_SHORT).show();
            }
        }
    });
}
项目:mtredi    文件:Register.java   
public void registerOnClick(View v) {
    name = userName.getText().toString();
    pass = password.getText().toString();
    mail = Mail.getText().toString();
    if(name.length() < 4 || pass.length() < 6 || mail.length() == 0)
        System.out.println("Something has fucked up");
    final ParseUser user = new ParseUser();
    user.setUsername(name);
    user.setEmail(mail);
    user.setPassword(pass);
    System.out.println("Request sent");
    user.signUpInBackground(new SignUpCallback() {
        @Override
        public void done(ParseException e) {
            System.out.println("Got Response");
            if(e == null) {
                startActivity(new Intent(Register.this, UserList.class));
            }
            else e.printStackTrace();
        }
    });
}
项目:ClassDiscuss    文件:MainActivity.java   
public void connectToParse(){
    Profiles profiles = Profiles.getInstance();
    String loginUser = profiles.loginEmail.replace("@ualberta.ca", "");
    //create new user
    ParseUser userParse = new ParseUser();
    userParse.setUsername(loginUser);
    userParse.setPassword(loginUser);
    userParse.setEmail(profiles.loginEmail);

    userParse.signUpInBackground(new SignUpCallback() {
        public void done(ParseException e) {
            if (e == null) {
                // Hooray! Let them use the app now.
                initiateParse();
                startApp();
            } else {
                // Sign up didn't succeed. Look at the ParseException
                // to figure out what went wrong
                login();
            }
        }
    });
}
项目:Cloud_Base-To-Do-App    文件:LoginSignupActivity.java   
private void signup(String usernametxt, String passwordtxt) {
    if (!isEmpty()){

        int numberParse = 0;
        ParseQuery<ParseUser> numberofUsers = ParseUser.getQuery();  // Note to myself : count users in parse class
        try {
            numberParse=numberofUsers.count();
        } catch (ParseException e1) {
            e1.printStackTrace();
        }
        user = new ParseUser();
        user.setUsername(usernametxt);
        user.setPassword(passwordtxt);
        user.put("userID",numberParse+1);
        user.signUpInBackground(new SignUpCallback() {
            public void done(ParseException e) {
                checkSignup(e);
            }
        });
    }
}
项目:AutoTimeHelper    文件:UserAPI.java   
public void create(User user) {
    Log.d("User", "start method create in UserCRUD");
    ParseUser usr = new ParseUser();
    usr.put(USERNAME, user.getUsername());
    usr.put(PASSWORD, user.getPassword());
    usr.put(EMAIL, user.getEmail());
    Log.d("User", user.getUsername());
    usr.signUpInBackground(new SignUpCallback() {

        @Override
        public void done(ParseException e) {
            if (e == null) {
                Log.d("User", "h send empty message");
                handler.sendEmptyMessage(CONNECTION_OK);
                Log.d("User", "h = 1");
            } else {
                handler.sendEmptyMessage(0);
                Log.d("User", "exception" + e.toString());
            }
        }
    });
}
项目:mirante    文件:NewAccountActivity.java   
@OnClick(R.id.saveNewAccount) void createAccount(View view) {
    ParseUser parseUser = new ParseUser();
    parseUser.setUsername(newUser.getText().toString());
    parseUser.setEmail(newUser.getText().toString());
    parseUser.setPassword(newPassword.getText().toString());
    parseUser.put(Constants.PARSE_USER_ATTR_NAME, newName.getText().toString().trim());

    parseUser.signUpInBackground(new SignUpCallback() {
        public void done(ParseException e) {
            if (e == null) {
                // Hooray! Let them use the app now.
                Log.e(LOG_TAG, "Hooray! Let them use the app now");
                Toast.makeText(getApplicationContext(), "Hooray! Let them use the app now", Toast.LENGTH_SHORT).show();
                handleAccountCreated();

            } else {
                // Sign up didn't succeed. Look at the ParseException
                // to figure out what went wrong
                Log.e(LOG_TAG, "Sign up didn't succeed. Look at the ParseException");
                Toast.makeText(getApplicationContext(), "Sign up didn't succeed. Look at the ParseException", Toast.LENGTH_SHORT).show();
            }
        }
    });
}
项目:mirante    文件:MainActivity.java   
@OnClick(R.id.createAccountButton) void createUser(View view){
    ParseUser parseUser = new ParseUser();
    parseUser.setUsername(personName.getText().toString());
    parseUser.setEmail(email.getText().toString());
    parseUser.setPassword(password.getText().toString());

    parseUser.signUpInBackground(new SignUpCallback() {
        public void done(ParseException e) {
            if (e == null) {
                // Hooray! Let them use the app now.
                Log.e(LOG_TAG, "Hooray! Let them use the app now");
                Toast.makeText(getApplicationContext(), "Hooray! Let them use the app now", Toast.LENGTH_SHORT).show();

            } else {
                // Sign up didn't succeed. Look at the ParseException
                // to figure out what went wrong
                Log.e(LOG_TAG, "Sign up didn't succeed. Look at the ParseException");
                Toast.makeText(getApplicationContext(), "Sign up didn't succeed. Look at the ParseException", Toast.LENGTH_SHORT).show();
            }
        }
    });

}
项目:Chirps    文件:Admin.java   
public Admin(String username, String password, String email) {
    // Create a basic user.
    ParseUser adminUser = new ParseUser();
    adminUser.setUsername(username);
    adminUser.setPassword(password);
    adminUser.setEmail(email);

    adminUser.signUpInBackground(new SignUpCallback() {
        @Override
        public void done(ParseException e) {
            if (e == null) {
                Log.i("Admin User Creation", "Account creation for username  success!");
                // Associate with role only when account is created successfully.
                associateRole();
            } else {
                Log.e("Admin User Creation", e.getMessage());
            }
        }
    });
}
项目:codecampsdq4Parse    文件:SignUpActivity.java   
public void doSignUp(View view) {
    ParseUser user = new ParseUser();
    user.setUsername(((EditText) findViewById(R.id.etSignUpUser)).getText().toString());
    user.setPassword(((EditText) findViewById(R.id.etSignUpPassword)).getText().toString());
    user.setEmail(((EditText) findViewById(R.id.etSignUpEmail)).getText().toString());

    user.signUpInBackground(new SignUpCallback() {
        public void done(ParseException e) {
            if (e == null) {
                startActivity(new Intent(mContext, MyActivity.class));
            } else {
                Toast.makeText(mContext,e.getMessage(),Toast.LENGTH_LONG).show();
            }
        }
    });
}
项目:wallet    文件:LoginActivity.java   
/**
 * Signs the user up with the provided info.  If signup succeeds,
 * you should call finishSuccessfulLoginOrSignup() to close this
 * screen.  If signup fails, you should call showSignupFailedToast();
 * @param email
 * @param password
 */
private void handleSignUp(String email, String password) {
  ParseUser user = new ParseUser();
  user.setUsername(email);
  user.setPassword(password);
  user.setEmail(email);
  user.signUpInBackground(new SignUpCallback() {
    @Override
    public void done(ParseException e) {
      if (e == null) {
        Log.d(TAG, "Successfully signed up");
        finishSuccessfulLoginOrSignup();
      } else {
        Log.d(TAG, "Signup failed: " + e.getMessage());
        showSignupFailedToast(e);
      }
    }
  });
}
项目:ExpertAndroid    文件:SignupActivity.java   
private void signup(String userId, String email, String password) {
    ParseUser user = new ParseUser();
    user.setUsername(userId);
    user.setEmail(email);
    user.setPassword(password);

    this.turnOnProgressDialog("Signup", "Please wait while we sign you up");

    user.signUpInBackground(new SignUpCallback() {
        @Override
        public void done(ParseException e) {
            turnOffProgressDialog();
            if (e == null) {
                signupSuccessful();
            } else {
                signupFailed(e);
            }
        }
    });
}
项目:ExpertAndroid    文件:SignupActivity.java   
private void signup(String userid, String email, String password)
{
    ParseUser user = new ParseUser();
    user.setUsername(userid);
    user.setPassword(password);
    user.setEmail(email);

    //Show the progress dialog
    turnOnProgressDialog("Signup", "Please wait while we sign you up");

    //Go for signup with a callback
    user.signUpInBackground(new SignUpCallback() {
      public void done(ParseException e) {
        turnOffProgressDialog();
        if (e == null) {
          // Hooray! Let them use the app now.
            signupSuccessful();
        } else {
          // Sign up didn't succeed. Look at the ParseException
          // to figure out what went wrong
          signupFailed(e);
        }
      }
    });     
    return;
}
项目:RegLog    文件:RegisterServiceParseImpl.java   
public void signUpInBackground(ParseUser user){
    user.signUpInBackground(new SignUpCallback() {
        @Override
        public void done(ParseException e) {
            if (e == null) {
                EventBus.getDefault().post(new RegisterCallbackEvent(true,null));
            } else {
                EventBus.getDefault().post(new RegisterCallbackEvent(true,e.getMessage()));
            }
        }
    });
}
项目:langren    文件:UserNameActivity.java   
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.next://注册页面的 账号及密码 保存到数据库
            final String username = game_number.getText().toString();
            final String password = game_password.getText().toString();
            final String nickname = game_name.getText().toString();
            final UserInfo user = new UserInfo();
            user.setUsername(username);
            user.setPassword(password);
            user.put("nickname",nickname);
            user.signUpInBackground(new SignUpCallback() {
                @Override
                public void done(ParseException e) {
                    if(e!=null){
                        e.printStackTrace();
                        Toast.makeText(UserNameActivity.this, "注册失败"+" code:"+e.getCode(), Toast.LENGTH_SHORT).show();
                    }else{
                       Intent intent = new Intent(UserNameActivity.this, UserHeadActivity.class);
                       startActivity(intent);
                        SoundEffectManager.play(R.raw.complete);
                       finish();
                    }
                }
            });

            break;
        case R.id.showPassword://点击显示密码
            if (click) {
                game_password.setTransformationMethod(null);//显示密码
                click = false;
            } else {
                game_password.setTransformationMethod(PasswordTransformationMethod.getInstance());//隐藏密码
                click = true;
            }
            break;
    }
}
项目:roboscout    文件:SignupActivity.java   
/**
 * Creates a new user in the Parse backend using the provided credentials
 *
 * @param teamNumber the team number to signup to
 * @param email      the email of the user
 * @param pass       the password of the user account
 */
public void signup(final String teamNumber, final String email, String pass, final View view) {
    if (!isNetworkAvailable()) {
        Snackbar.make(view, "Unable to connect to the Internet. Try again.", Snackbar.LENGTH_SHORT).show();
        return;
    }

    // Make sure all fields are filled in
    if (teamNumber.equals("") || email.equals("") || pass.equals("")) {
        Snackbar.make(view, "Please fill in all fields.", Snackbar.LENGTH_SHORT).show();
        return;
    }

    // Create new ParseUser object to signup with field credentials
    ParseUser user = new ParseUser();
    user.setEmail(email);
    user.setUsername(email);
    user.setPassword(pass);
    user.put("Team", teamNumber);

    user.signUpInBackground(new SignUpCallback() {
        @Override
        public void done(ParseException e) {
            // Signup was successful, no exception
            if (e == null) {
                Snackbar.make(view, "Successfully signed up.", Snackbar.LENGTH_SHORT).show();
                sessionManager.createLoginSession(teamNumber, email);
                startActivity(new Intent(getApplicationContext(), TeamListActivity.class));
                finish();
            } else {
                Snackbar.make(view, "Unable signed up. Please try again.", Snackbar.LENGTH_SHORT).show();
                password.setText("");
                passwordAgain.setText("");
            }
        }
    });

}
项目:Barter    文件:SignIn.java   
public void signup() {
    final Intent myintent = new Intent(getActivity(),HomePage.class);
    if (!name.getText().toString().isEmpty() && !email.getText().toString().isEmpty() && !pass.getText().toString().isEmpty()  && !repass.getText().toString().isEmpty() && pass.getText().toString().equals(repass.getText().toString()) && pass.getText().toString().length() >= 6)
    {
        ParseUser user = new ParseUser();
        user.setUsername(email.getText().toString());
        user.setPassword(pass.getText().toString());
        user.setEmail(email.getText().toString());
        user.put("Name",name.getText().toString());

        user.signUpInBackground(new SignUpCallback() {
            public void done(ParseException e) {
                if (e == null) {
                    showSuccess("Please verify your email, then click the login button");
                    firebaseSignUp(email.getText().toString());
                } else {
                    showIssue(e.toString());
                }
            }
        });
    }else if (name.getText().toString().isEmpty() || email.getText().toString().isEmpty() || pass.getText().toString().isEmpty()  || repass.getText().toString().isEmpty()){
        showIssue("Please makes sure you fill out all the fields properly!");
    }else if(!pass.getText().toString().equals(repass.getText().toString())){
        showIssue("Oops your passwords do not match, please try again");
    }else if(pass.getText().toString().length()<6){
        showIssue("Please make sure your password is at least six characters long");
    }
}
项目:cat-chat-android    文件:SignUpActivity.java   
@Override
public void onClick(View view) {
    String emailAddress = getEmailAddress();
    String password = getPassword();

    mProgressDialog = CatProgressDialog.show(SignUpActivity.this, getString(R.string.signing_up));

    ParseUser user = new ParseUser();
    user.setUsername(emailAddress);
    user.setPassword(password);
    user.setEmail(emailAddress);

    user.signUpInBackground(new SignUpCallback() {
        public void done(ParseException e) {
            mProgressDialog.dismiss();

            if (e == null) {
                Utils.mapInstallationToCurrentUser();
                startActivity(new Intent(SignUpActivity.this, InboxActivity.class));
                finish();
            } else {
                mEmailEditText.setError(e.getMessage());
                Log.e("CatChatSignUp", "Failed to signup", e);
            }
        }
    });
}
项目:ShopAfter    文件:SignInFragment.java   
@OnClick(R.id.b_signin) public void onClickBtnSignin() {
  boolean isOk = true;
  if (etName.getText() == null || etName.getText().length() == 0) {
    etName.setError("What is your name?");
    isOk = false;
  }
  if (etEmail.getText() == null || etEmail.getText().length() == 0) {
    etEmail.setError("What is your email?");
    isOk = false;
  }
  if (etPassword.getText() == null || etPassword.getText().length() == 0) {
    etPassword.setError("Please enter your password");
    isOk = false;
  }
  if (isOk) {
    final ParseUser user = new ParseUser();
    user.setUsername(etName.getText().toString());
    user.setEmail(etEmail.getText().toString());
    user.setPassword(etPassword.getText().toString());
    user.signUpInBackground(new SignUpCallback() {
      public void done(ParseException e) {
        if (e == null) {
          Timber.i("A new account created :) ");
          Toast.makeText(getActivity(), "A new account is created :) ", Toast.LENGTH_LONG).show();
        } else {
          Timber.e(e, "Sign up didn't succeed. Look at ParseException for details");
          Toast.makeText(getActivity(), "Email account is ", Toast.LENGTH_LONG).show();
        }
      }
    });
  }
}
项目:Coins    文件:SignUpActivity.java   
/**
 * Sign up using Parse API.
 */
private void signUp()
{
    ParseUser user = new ParseUser();
    user.setUsername(mUserEditText.getText().toString());
    user.setEmail(mUserEditText.getText().toString());
    user.setPassword(mPassEditText.getText().toString());

    user.signUpInBackground(new SignUpCallback()
    {
        public void done(ParseException e)
        {
            if (e == null)
            {
                Utils.showPrettyToast(SignUpActivity.this, "An email verifcation was sent to \"" +
                        mUserEditText.getText().toString() + "\"\nPlease verify your account.", PrettyToast.VERY_LONG);
                goToLogin();
                finish();
                overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
            }
            else
                singUpFailed();

            showProgress(false);
        }
    });
}
项目:interloco    文件:SignUpFragment.java   
@Override
public void onClick(View v) {

    switch (v.getId()) {
    case R.id.signup:

        if (!verify()) {
            return;
        }
        User user = new User();
        setShowProgress(true);
        user.signup(usernameEdit.getText().toString(), passwordEdit
                .getText().toString(), emailEdit.getText().toString(),
                new SignUpCallback() {

                    @Override
                    public void done(ParseException e) {
                        setShowProgress(false);
                        if (e != null) {
                            Toast.makeText(getActivity(), e.getMessage(),
                                    Toast.LENGTH_SHORT).show();
                        } else {
                            Toast.makeText(getActivity(),
                                    getString(R.string.signup_success),
                                    Toast.LENGTH_SHORT).show();
                            if (listener != null) {
                                listener.onSignUpSuccess();
                            }
                        }
                    }
                });
        break;

    default:
        break;
    }
}
项目:interloco    文件:User.java   
public void signup(String username, String pass, String email,
        SignUpCallback callback) {
    parseUser.setUsername(username);
    parseUser.setPassword(pass);
    parseUser.setEmail(email);
    parseUser.signUpInBackground(callback);
}
项目:libertacao-android    文件:ParseSignupFragment.java   
@Override
public void onClick(View v) {
    if(!validate()){
        return;
    }

    // Check if password match
    final String password = passwordField.getText().toString();
    if(!password.equals(confirmPasswordField.getText().toString())){
        confirmPasswordField.setError(MyApp.getAppContext().getString(R.string.passwordNotMatch));
        confirmPasswordField.setText("");
        confirmPasswordField.requestFocus();
        return;
    }

    String username = usernameField.getText().toString();
    String email = emailField.getText().toString();
    ParseUser user = new ParseUser();
    // Set standard fields
    user.setUsername(username);
    user.setPassword(password);
    user.setEmail(email);

    loadingStart();
    user.signUpInBackground(new SignUpCallback() {

        @Override
        public void done(ParseException e) {
            if (isActivityDestroyed()) {
                return;
            }

            if (e == null) {
                loadingFinish();
                signupSuccess();
            } else {
                loadingFinish();

                switch (e.getCode()) {
                    case ParseException.INVALID_EMAIL_ADDRESS:
                        showToast(R.string.invalidEmail);
                        break;
                    case ParseException.USERNAME_TAKEN:
                        showToast(R.string.usernameTaken);
                        break;
                    case ParseException.EMAIL_TAKEN:
                        showToast(R.string.emailTaken);
                        break;
                    default:
                        showToast(R.string.unknownSignupError);
                }
            }
        }
    });
}
项目:connectedteam-android    文件:SignupFragment.java   
private void clearFocusAndSubmit() {
        View focussedView = getView().findFocus();
        if (focussedView != null) focussedView.clearFocus();
        List<String> validationErrors = new ArrayList<>();
        //boolean passwordsOK = !StringUtils.isAnyNullOrEmpty(mPassword1) && mPassword1.length()>0;
        //if(!passwordsOK) validationErrors.add("Passwords do not match");
        final ParseUser parseUser = new ParseUser();
        if (mCustomer.password==null || mCustomer.password.length()<CustomerHelper.MIN_PASSWORD_LENGTH)
            validationErrors.add(String.format("A valid password is required of at least %d characters", CustomerHelper.MIN_PASSWORD_LENGTH));
        else parseUser.setPassword(mCustomer.password);
        String email = mCustomer.getEmail();
        if(email!=null) {
            parseUser.setEmail(email);
            parseUser.setUsername(email);
        }
        parseUser.put("firstName", mCustomer.firstName);
        parseUser.put("lastName", mCustomer.lastName);
        validationErrors.addAll(CustomerHelper.validate(parseUser));

        if(validationErrors.size()>0){
            aq.id(R.id.validation).text(StringUtils.stringListToString(validationErrors, "\n", false));
        }
        else{
            requestingCount=1;
            onRequestingChanged();
            aq.id(R.id.validation).text("");
            parseUser.signUpInBackground(new SignUpCallback() {
                @Override
                public void done(ParseException e) {
                    requestingCount=0;
                    onRequestingChanged();
                    if (e != null) {
                        new AlertDialog.Builder(getActivity()).setMessage(e.getMessage()).setPositiveButton(R.string.ok, null).show();
                    } else {
                        if (ConnectedApp.DEBUG)
                            Toast.makeText(getActivity(), "Signup success", Toast.LENGTH_SHORT).show();
                        Session.getInstance().setCustomerHeader(parseUser, mCustomer.password);
//                        Intent intent = new Intent(getActivity(), PreferencesActivity.class);
//                        startActivity(intent);
//                        getActivity().finish();
                    }
                }
            });

        }
    }
项目:AnyWall    文件:SignUpActivity.java   
private void signup() {
  String username = usernameEditText.getText().toString().trim();
  String password = passwordEditText.getText().toString().trim();
  String passwordAgain = passwordAgainEditText.getText().toString().trim();

  // Validate the sign up data
  boolean validationError = false;
  StringBuilder validationErrorMessage = new StringBuilder(getString(R.string.error_intro));
  if (username.length() == 0) {
    validationError = true;
    validationErrorMessage.append(getString(R.string.error_blank_username));
  }
  if (password.length() == 0) {
    if (validationError) {
      validationErrorMessage.append(getString(R.string.error_join));
    }
    validationError = true;
    validationErrorMessage.append(getString(R.string.error_blank_password));
  }
  if (!password.equals(passwordAgain)) {
    if (validationError) {
      validationErrorMessage.append(getString(R.string.error_join));
    }
    validationError = true;
    validationErrorMessage.append(getString(R.string.error_mismatched_passwords));
  }
  validationErrorMessage.append(getString(R.string.error_end));

  // If there is a validation error, display the error
  if (validationError) {
    Toast.makeText(SignUpActivity.this, validationErrorMessage.toString(), Toast.LENGTH_LONG)
        .show();
    return;
  }

  // Set up a progress dialog
  final ProgressDialog dialog = new ProgressDialog(SignUpActivity.this);
  dialog.setMessage(getString(R.string.progress_signup));
  dialog.show();

  // Set up a new Parse user
  ParseUser user = new ParseUser();
  user.setUsername(username);
  user.setPassword(password);

  // Call the Parse signup method
  user.signUpInBackground(new SignUpCallback() {
    @Override
    public void done(ParseException e) {
      dialog.dismiss();
      if (e != null) {
        // Show the error message
        Toast.makeText(SignUpActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
      } else {
        // Start an intent for the dispatch activity
        Intent intent = new Intent(SignUpActivity.this, DispatchActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
      }
    }
  });
}
项目:class_board_app    文件:SignUpActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_signup);

  // Set up the signup form.
  usernameView = (EditText) findViewById(R.id.username);
  passwordView = (EditText) findViewById(R.id.password);
  passwordAgainView = (EditText) findViewById(R.id.passwordAgain);

  // Set up the submit button click handler
  findViewById(R.id.action_button).setOnClickListener(new View.OnClickListener() {
    public void onClick(View view) {

      // Validate the sign up data
      boolean validationError = false;
      StringBuilder validationErrorMessage =
          new StringBuilder(getResources().getString(R.string.error_intro));
      if (isEmpty(usernameView)) {
        validationError = true;
        validationErrorMessage.append(getResources().getString(R.string.error_blank_username));
      }
      if (isEmpty(passwordView)) {
        if (validationError) {
          validationErrorMessage.append(getResources().getString(R.string.error_join));
        }
        validationError = true;
        validationErrorMessage.append(getResources().getString(R.string.error_blank_password));
      }
      if (!isMatching(passwordView, passwordAgainView)) {
        if (validationError) {
          validationErrorMessage.append(getResources().getString(R.string.error_join));
        }
        validationError = true;
        validationErrorMessage.append(getResources().getString(
            R.string.error_mismatched_passwords));
      }
      validationErrorMessage.append(getResources().getString(R.string.error_end));

      // If there is a validation error, display the error
      if (validationError) {
        Toast.makeText(SignUpActivity.this, validationErrorMessage.toString(), Toast.LENGTH_LONG)
            .show();
        return;
      }

      // Set up a progress dialog
      final ProgressDialog dlg = new ProgressDialog(SignUpActivity.this);
      dlg.setTitle("Please wait.");
      dlg.setMessage("Signing up.  Please wait.");
      dlg.show();

      // Set up a new Parse user
      ParseUser user = new ParseUser();
      user.setUsername(usernameView.getText().toString());
      user.setPassword(passwordView.getText().toString());
      // Call the Parse signup method
      user.signUpInBackground(new SignUpCallback() {

        @Override
        public void done(ParseException e) {
          dlg.dismiss();
          if (e != null) {
            // Show the error message
            Toast.makeText(SignUpActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
          } else {
            // Start an intent for the dispatch activity
            Intent intent = new Intent(SignUpActivity.this, RouteActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
          }
        }
      });
    }
  });
}
项目:Chirps    文件:SignUpActivity.java   
/**
 * Creates the user and saves them to Parse.
 * @param email
 * @param password
 * @param name
 * @param school
 */
public void createUser(String email, String password, String name, String school) {
    ParseUser user = new ParseUser();
    user.setUsername(email);
    user.setPassword(password);
    user.setEmail(email);
    user.put("name", name);
    user.put("school", school);

    user.signUpInBackground(new SignUpCallback() {
        public void done(ParseException e) {
            if (e == null) {
                // Show a simple Toast message upon successful registration
                Toast.makeText(getApplicationContext(),
                        "Successfully Signed up, " +
                                "please confirm email before logging in to fully " +
                                "utilize all of Chirp's features.",
                        Toast.LENGTH_LONG).show();
                Intent intent = new Intent(
                        SignUpActivity.this,
                        LoginActivity.class);
                startActivity(intent);
                finish();
            } else {
                switch (e.getCode()) {
                    case ParseException.INVALID_EMAIL_ADDRESS:
                        Toast.makeText(getApplicationContext(),
                                "Invalid email address.", Toast.LENGTH_LONG)
                                .show();
                        break;
                    case ParseException.USERNAME_TAKEN:
                        Toast.makeText(getApplicationContext(),
                                "Username is already taken. Please enter a different one.",
                                Toast.LENGTH_LONG)
                                .show();
                        break;
                    case ParseException.EMAIL_TAKEN:
                        Toast.makeText(getApplicationContext(),
                                "Username is already taken. Please enter a different one.",
                                Toast.LENGTH_LONG)
                                .show();
                        break;
                    default:
                        Toast.makeText(getApplicationContext(),
                                "Could not sign up, please try again later.",
                                Toast.LENGTH_LONG)
                                .show();
                }
            }
        }
    });
}
项目:CloudyPhone    文件:SignupClickListener.java   
@Override
public void onClick(View v) {
    EditText email = emailReference.get();
    EditText password = passwordReference.get();
    EditText repeatPassword = repeatPasswordReference.get();

    String emailString = email.getText().toString();
    String passwordString = password.getText().toString();
    String passwordRepeatString = repeatPassword.getText().toString();

    boolean validEmail = InputValidator.validateEmail(emailString);
    boolean validPassword = InputValidator.validatePassword(passwordString);
    boolean validRepeat = passwordString.equals(passwordRepeatString);

    if (!validEmail) {
        email.setError(context.getString(R.string.email_error));
    }

    if (!validPassword) {
        password.setError(context.getString(R.string.password_error));
    }

    if (!validRepeat) {
        repeatPassword.setError(context
                .getString(R.string.password_repeat_error));
    }

    if (validEmail && validPassword && validRepeat) {
        // everything is ok
        ProgressDialog progressDialog = ProgressDialog.show(context, "",
                context.getString(R.string.signing));
        progressDialog.setCancelable(true);

        ParseUser user = new ParseUser();
        user.setUsername(email.getText().toString());
        user.setPassword(password.getText().toString());

        SignUpCallback signUpCallback = new MySignUpCallback(context,
                progressDialog);

        user.signUpInBackground(signUpCallback);
    }
}
项目:Social-Networking-App-where-you-smiling-is-liking-the-post    文件:SignupActivity.java   
public void done_fun(View v)
{

 if(verificatio_ed.getText().toString().trim().length()<1)
 {
     Toast.makeText(con, "Please enter a valid verification code", Toast.LENGTH_LONG).show();
 }
 else
 {
     if(verificatio_ed.getText().toString().trim().equals(Integer.toString(verification_code)))
     {
         //Authentication successful
            final ProgressDialog dlg = new ProgressDialog(SignupActivity.this);
       dlg.setTitle("Please wait.");
       dlg.setMessage("Signing up.");
       dlg.show();

       user.put("phone_number", number);
       // Call the Parse signup method
       user.signUpInBackground(new SignUpCallback() {

         @Override
         public void done(ParseException e) {
           dlg.dismiss();
           if (e != null) {
             // Show the error message
             Toast.makeText(SignupActivity.this, e.getMessage(), Toast.LENGTH_LONG).show();
           } else {
             // Start an intent for the dispatch activity
             Intent intent = new Intent(SignupActivity.this, DispatchActivity.class);
             intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
             startActivity(intent);
           }
         }
       });
     }
     else
         Toast.makeText(con, "Verification code mismatch. Please try again.", Toast.LENGTH_LONG).show();
 }

}