按下登录按钮后应用程序重新启动

时间:2015-02-17 02:48:00

标签: android

我正在尝试在Android中创建登录脚本。当我使用不正确的密码按下登录按钮时,应用程序立即关闭。当我尝试使用错误的密码登录时,会发生这种情况。找到以下代码:

    public void onClick(View arg0) {
        String pass = txtpass.getText().toString();
        if( pass.equals("") ){
            Toast.makeText(getApplicationContext(), "No Password", Toast.LENGTH_LONG).show();
        } else {
            StoreReport check = new StoreReport(Login.this);
            check.open();
            boolean ver;
            ver = check.verify( pass )? true : false ;
            if(ver == true) {
               //Starting a new Intent
               Intent logins = new Intent(getApplicationContext(), DailyReport.class);
               startActivity(logins);
            } else {
              Toast.makeText(getApplicationContext(), "Wrong Password.. Try Again", Toast.LENGTH_LONG).show();
          }
          check.close();
      }
   }
}

0 个答案:

没有答案