Show Error on the tip of the Edit Text Android

前端 未结 12 2117
一生所求
一生所求 2020-12-01 04:30

I want to show error if the user enters blank value in the edittext.But i am not getting the way how could i do this .This is how i want like this:

12条回答
  •  孤独总比滥情好
    2020-12-01 04:43

    u can use this :

    @Override
            public void afterTextChanged(Editable s) {
                super.afterTextChanged(s);
                if (s.length() == Bank.PAN_MINIMUM_RECOGNIZABLE_LENGTH + 10) {
                    Bank bank = BankUtil.findByPan(s.toString());
                    if (null != bank && mNewPanEntered && !mNameDefined) {
                        mNewPanEntered = false;
                        suggestCardName(bank);
                    }
    

    private void suggestCardName(Bank bank) {
        mLastSuggestTime = System.currentTimeMillis();
        if (!bank.getName().trim().matches(getActivity().getString(R.string.bank_eghtesadnovin))) {
            inputCardNumber.setError(R.string.balance_not_enmb, true);
    
        }
    }
    

提交回复
热议问题