When i Run the application application is crashing (Did i written the code wrong)?
Here is my post:
public class SignUP extends AppCompatActivity implements View.OnClickListener {
private EditText edtEmail,edtUserName, edtPassword;
private Button btnSignUp,btnLogin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sign_up);
edtEmail = findViewById(R.id.edtEnterEmail);
edtUserName = findViewById(R.id.edtUserName);
edtPassword = findViewById(R.id.edtEnterPassword);
btnSignUp = findViewById(R.id.btnSignUp);
btnLogin = findViewById(R.id.btnLogin);
btnSignUp.setOnClickListener(this);
btnLogin.setOnClickListener(this);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btnSignUp:
final ParseUser appUser = new ParseUser();
appUser.setEmail(edtEmail.getText().toString());
appUser.setUsername(edtUserName.getText().toString());
appUser.setPassword(edtPassword.getText().toString());
appUser.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
if (e == null){
FancyToast.makeText(SignUP.this,appUser.getUsername() + "is signed up",
FancyToast.LENGTH_LONG, SUCCESS,true).show();
Intent intent = new Intent(SignUP.this,LoginActicvity.class);
startActivity(intent);
}else{
FancyToast.makeText(SignUP.this,"There was an error: "
+ e.getMessage(),FancyToast.LENGTH_LONG, ERROR,true).show();
}
}
});
break;
case R.id.btnLogin:
break;
}
}
}
This is My error when i try to run the application :
java.lang.IllegalArgumentException: You must create this type of ParseObject using ParseObject.create() or the proper subclass.
Its showing like this.
Make sure you've initialized Parse in your Application class.
And you also need to create a
ParseObject
.