@OnClick(intArrayOf(R.id.btn_sign_in_by_phone, R.id.btn_sign_in_by_login))
fun onMethodClick(btn: Button) {
This does not work unfortunately
@OnClick([..., ...])
@JakeWharton thank you for your response but it does not work. I am getting:
Type inference failed. Expected type mismatch:
required:
Int
found:
Array<Int>
@OnClick(value = [R.id.btn_sign_in_by_phone, R.id.btn_sign_in_by_login])
but this has worked ^^
@OnClick(R.id.btn_pwd_show_hide, R.id.btn_check_rem, R.id.iv_back, R.id.btn_login, R.id.tv_register, R.id.tv_forget_pwd)
internal fun click(view: View) {
when (view.id) {
R.id.btn_pwd_show_hide -> if (btnPwdShowHide!!.isSelected) {
btnPwdShowHide!!.isSelected = false
etPwd!!.transformationMethod = PasswordTransformationMethod.getInstance()
} else {
btnPwdShowHide!!.isSelected = true
etPwd!!.transformationMethod = HideReturnsTransformationMethod.getInstance()
}
//boolean rem account
R.id.btn_check_rem -> if (btnCheckRem!!.isSelected) {
PrefUtils.putBoolean(Constant.SP_REMEMBER_ACCOUNT_KEY, false, this)
btnCheckRem!!.isSelected = false
} else {
PrefUtils.putBoolean(Constant.SP_REMEMBER_ACCOUNT_KEY, true, this)
btnCheckRem!!.isSelected = true
}
R.id.iv_back -> onBackPressed()
Why can't still work? Single @onclick also does not work Please rescue me锛乼hx
Most helpful comment
@OnClick(value = [R.id.btn_sign_in_by_phone, R.id.btn_sign_in_by_login])but this has worked ^^