我正在使用Emailaddress在SignIn Activity中使用forgotPassword,这里我的电子邮件匹配在数据库中以获取更改密码的记录。 我的代码在下面
public String updatePassword(String newPassword ,String mEmail){
SQLiteDatabase db = getWritableDatabase();
String mQuery ="update "+ TABLE_USERDETIAL + " set "+ KEY_PASSWORD +"="+newPassword+" where " +mEmail;
db.execSQL(mQuery);
return mEmail;
}
上面的代码写在dataBase中,我的记录将被更新。
我的问题是如何编码来更改特定邮件地址的密码。
ForgotPasswordActivity
public class ForgotPasswordActivity extends AppCompatActivity {
private EditText edtPassword;
private EditText edtConformPassword;
private Button btnRegister;
private TextView txtEmail;
DatabaseHelper databaseHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_forgot_password);
databaseHelper = new DatabaseHelper(this);
edtPassword = (EditText)findViewById(R.id.edt_password);
edtConformPassword = (EditText)findViewById(R.id.edt_conform_password);
btnRegister = (Button) findViewById(R.id.btn_register);
txtEmail = (TextView) findViewById(R.id.txt_email);
Intent intent = getIntent();
String mEmail = intent.getStringExtra("KEY_EMAIL");
txtEmail.setText(mEmail);
btnRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String mEmail = txtEmail.getText().toString();
String newPassword = edtPassword.getText().toString();
String mMail = databaseHelper.updatePassword(mEmail,newPassword);
if (edtPassword.equals(edtConformPassword)){
if (){
}
}
}
});}}
可以帮助我修改代码(edtPassword.equals(edtConformPassword)){in ForgotPasswordActivity