I have a problem in the method of validating loguin, it is logging in with both the correct login and password and with them wrong. When it logs in with the wrong login the id of the user goes to 0 and if it logs with the correct data the id goes 1 as a business?
public Usuario validarLogin(String login, String senha) {
String[] selectionArgs = new String[]{login, senha};
Cursor cursor;
cursor = db.rawQuery("select * from usuarios where login=? and senha=?", selectionArgs);
Usuario usuarioLinha = new Usuario();
if (cursor.moveToNext()) {
usuarioLinha.setId(cursor.getLong(cursor.getColumnIndex("id_usuario")));
usuarioLinha.setEmail(cursor.getString(cursor.getColumnIndex("email")));
usuarioLinha.setLogin(cursor.getString(cursor.getColumnIndex("login")));
usuarioLinha.setSenha(cursor.getString(cursor.getColumnIndex("senha")));
}
return usuarioLinha;
}