我在解析数据库中将用户添加到我的User类时遇到了问题。启动应用程序并重新启动我的parse.com网页后,我看不到任何结果。有人可以帮助我吗?
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(layout.activity_login);
final EditText username = (EditText) this.findViewById(id.userloginname);
final EditText password = (EditText) this.findViewById(id.userpassword);
TextView neighbourView = new TextView(this);
Button button_test;
button_test = (Button) this.findViewById(id.btnLogin);
button_test.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
final String usersname = username.getText().toString();
final String passwoord = password.getText().toString();
//ParseQuery<ParseObject> query = ParseQuery.getQuery("Parking");
ParseUser.logInInBackground(usersname, passwoord, new LogInCallback() {
@Override
public void done(ParseUser user, com.parse.ParseException e) {
if (user != null) {
// Hooray! The user is logged in.
} else {
//
}
}
});
// return false;
}
});
}
答案 0 :(得分:0)
要创建全新用户,您应该使用ParseUser.signUpInBackground()
:
ParseUser user = new ParseUser();
user.setUsername(username);
user.setPassword(password);
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(ParseException e) {
//if e != null, something went wrong
}
});