我的注册信息不会存储在解析中

时间:2016-02-23 00:14:40

标签: android-studio parse-platform android-parser

尝试在解析时注册用户时,我不断收到错误消息。我也设置了电子邮件验证。我无法判断我的代码是否出错,看起来我跟着解析了" T"。

    public class Register extends AppCompatActivity {

    protected EditText mUsername;
    protected EditText mEmail;
    protected EditText mPassword;
    protected EditText mPhone;
    protected EditText mDob;
    protected Button mRegisterButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);



        mUsername=(EditText)findViewById(R.id.username);
        mEmail=(EditText)findViewById(R.id.email);
        mPassword=(EditText)findViewById(R.id.password);
        mPhone=(EditText)findViewById(R.id.phonenumber);
        mDob=(EditText)findViewById(R.id.birthday);
        mRegisterButton=(Button)findViewById(R.id.registerbutton);


        //listen to register button click
        mRegisterButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                //get info covert to string
                String username = mUsername.getText().toString().trim();
                String email = mEmail.getText().toString().trim();
                String password = mPassword.getText().toString().trim();
                String phonenumber= mPhone.getText().toString().trim();
                String birthday = mDob.getText().toString().trim();





                //store to parse
                ParseUser user = new ParseUser();
                user.setUsername(username);
                user.setPassword(password);
                user.setEmail(email);
                user.put(phonenumber, "650-253-0000");
                user.put(birthday,"00-00-000");
                user.signUpInBackground(new SignUpCallback() {
                    @Override
                    public void done(ParseException e) {
                        if (e == null) {
                            //user signed up succesfully
                            Toast.makeText(Register.this, "Welcome To The Party...", Toast.LENGTH_LONG).show();

                            //take user to home page
                        } else {
                            Toast.makeText(Register.this, "Error Try Again...", Toast.LENGTH_LONG).show();
                            //there was an error siging up


                        }

                    }
                });

            }
        });





        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
    }

}

0 个答案:

没有答案