我正在尝试在android中创建注册系统,但由于某种原因,它只是将ID添加到了数据库中,而没有用户名,电子邮件和密码。 这就是它添加(最后一个原始) PS的方式。我很确定php文件运行正常,因为我已经对其进行了测试
RegisterActivity.java
public class RegisterActivity extends AppCompatActivity {
TextView sign_in_text;
EditText Name,Email,Pass,ConPass;
Button reg_button;
AlertDialog.Builder mBuilder;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
sign_in_text = (TextView) findViewById(R.id.sign_in);
sign_in_text.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(RegisterActivity.this,LoginActivity.class));
}
});
Name = (EditText) findViewById(R.id.user_name);
Email = (EditText) findViewById(R.id.email_register);
Pass = (EditText) findViewById(R.id.password_register);
ConPass = (EditText) findViewById(R.id.password_conf);
reg_button = (Button) findViewById(R.id.reg_button);
reg_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(Name.getText().toString().equals("")|| Email.getText().toString().equals("")|| Pass.getText().toString().equals("")){
mBuilder = new AlertDialog.Builder(RegisterActivity.this);
mBuilder.setTitle("Oops something went wrong!");
mBuilder.setMessage("Please fill all the fields");
mBuilder.setPositiveButton("ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
}
});
AlertDialog alertDialog = mBuilder.create();
alertDialog.show();
}
相关分类