我有一个对话框,要求用户提供登录凭据。我想将该密码与之前存储用于身份验证的数据库值进行比较。M 做不到。任何人都可以帮忙吗?
public void onClick(View v) {
// TODO Auto-generated method stu
Toast.makeText(context, "Button Clicked", Toast.LENGTH_SHORT).show();
String existPin=exist_pin.getText().toString();
String confirmPin=new String();
prefEditor.putString("ExistPin", existPin);
prefEditor.commit();
WayDataBase way=new WayDataBase(LoginActivity.this);
String storedPin=way.getPin(confirmPin);
Toast.makeText(context, "Data from database", Toast.LENGTH_SHORT).show();
if(existPin.equals(storedPin))
{
d2.dismiss();
Intent i=new Intent(getApplicationContext(),ApplicantPage1.class);
startActivity(i);
}
else
{
Toast.makeText(context, "Invalid credentials", Toast.LENGTH_SHORT).show();
}
}