/* (non-Javadoc)
   * @see com.chatt.custom.CustomActivity#onClick(android.view.View)
   */
  @Override
  public void onClick(View v) {
    super.onClick(v);
    if (v.getId() == R.id.btnReg) {
      startActivityForResult(new Intent(this, Register.class), 10);
    } else {

      String u = user.getText().toString();
      String p = pwd.getText().toString();
      if (u.length() == 0 || p.length() == 0) {
        Utils.showDialog(this, R.string.err_fields_empty);
        return;
      }
      final ProgressDialog dia = ProgressDialog.show(this, null, getString(R.string.alert_wait));
      ParseUser.logInInBackground(
          u,
          p,
          new LogInCallback() {

            @Override
            public void done(ParseUser pu, ParseException e) {
              dia.dismiss();
              if (pu != null) {
                UserList.user = pu;
                startActivity(
                    new Intent(
                        Login.this,
                        UserList
                            .class)); // THis passes the user id to the Userlist Activity to
                                      // retrieve the user list.
                finish();
              } else {
                Utils.showDialog(Login.this, getString(R.string.err_login) + " " + e.getMessage());
                e.printStackTrace();
              }
            }
          });
    }
  }