在AndroidStudio中判断一个登录是否正确,使用了 if (c_user.moveToFirst()) 的判断,却直接跳过这个判断了。也没有报错信息,也就是说,它不正确或说没有进行这个的判断。但是,下面的 反向判断,却能判断 成功。
下面是判断 的代码
if (c_user.moveToFirst()) {
finish();
Toast.makeText(this, "登录成功!正在为你跳转界面!", Toast.LENGTH_SHORT).show();
Intent intent_function = new Intent(AcLogin.this, FrMainFragment.class);
this.startActivity(intent_function);
return;
}
if (!(c_user.moveToFirst())) {
Toast.makeText(this, "用户名或密码错误!请重新输入!", Toast.LENGTH_SHORT).show();
return;
}
c_user.close();
dbRead.close();
break;
下面是debug的图