我需要获取用户名和密码...我正在我的应用程序中进行密码恢复,所以这是我的 DB 代码:
public String getEmailAddr() throws SQLException {
Cursor mCursor = db.rawQuery(
"SELECT Username, Passwords FROM " +
USERS_TABLE + " WHERE EmailNO=?",null);
if (mCursor != null) {
if(mCursor.getCount() > 0 {
//return obj1.getpassword();
}
}
//return false;
return obj1.getpassword();
}
当用户输入电子邮件地址时,它必须首先检查是否存在并使用我的活动代码发送电子邮件返回密码和用户名:
public void onClick(View v) {
String EmailAddress = txtEmailAddress.getText().toString();
try {
if(EmailAddress.length() > 0) {
DBAdapter dbUser = new DBAdapter (RecoverPassword.this);
dbUser.open();
if(dbUser.getEmailAddress(EmailAddress)) {
Toast.makeText(RecoverPassword.this,
"Email Successfully ",
Toast.LENGTH_LONG).show();
Toast.makeText String to =
txtEmailAddress.getText().toString();
//String subject = EmailAddress.getText().toString();
// String message = EmailAddress.getText().toString();
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{ to});
email.putExtra(Intent.EXTRA_SUBJECT, "Password Recovery");
email.putExtra(Intent.EXTRA_TEXT, dbUser.getEmailAddr());
//need this to prompts email client only
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "gmail :"));
}
else {
Toast.makeText(RecoverPassword.this,
"Invalid Email", Toast.LENGTH_LONG).show();
txtEmailAddress.setText("");
}
dbUser.close();
}
}
catch(Exception e) {
Toast.makeText(RecoverPassword.
this,e.getMessage(), Toast.LENGTH_LONG).show();
}
Please help me to check what is wrong...but there is no error but it cant return
username and password to the email sent