Can anyone see any errors in this code? I've checked to make sure the data has been written to the database. Every time I click the button it gives me the "Incorrect Password" text. It's probably something stupid that I'm overlooking. Any help is appreciated.
public void buttonWork() {
button_credCheck.setOnClickListener(new View.OnClickListener() {
String rpq = regPwdQuery().toString();
String passInputStr = editText_pwdInput.getText().toString();
@Override
public void onClick(View v) {
if (passInputStr == rpq) {
Intent myIntent = new Intent(LogInActivity.this, FindInfoActivity.class);
startActivity(myIntent);
} else {
Toast.makeText(LogInActivity.this, "Incorrect Password", Toast.LENGTH_LONG).show();
}
}
});
}
EDIT: This is not a duplicate of the referenced question because changing == to equals() did not fix my problem.
EDIT 2: Thought maybe I should Include the cursor class for regPwdQuery
public Cursor regPwdQuery() {
String regPwdData = editText_pwdInput.getText().toString();
String regQuery = "SELECT * FROM UsrPass_table WHERE Pwrd ='" + regPwdData + "'";
SQLiteDatabase uDB = usrDB.getReadableDatabase();
Cursor result = uDB.rawQuery(regQuery, null);
return result;