RFA
RFA

Reputation: 851

Prevent softinput that opened from first edittext to open in second edittext

I have two edittexts.

It is supposed to have this behavior.

With addTextChangedListener every number input from edittext1 will be +1 and then the sum will be displayed on edittext2. If I input 2000 on edittext1 then edittext2 should then display 2001.

edittext2 should never be able to be editted by the user using the softinput . I was able to disable the softinput from showing by using

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { // API 21
        edittext2.setShowSoftInputOnFocus(false);
    } else { // API 11-20
        edittext2.setTextIsSelectable(true);
    }

However, if the softinput is opened while changing edittext1 and then the user clicks edittext2 the softinput doesnt get hidden so the user can still enter input.

I know that using setEnabled(false) would solve all of my problems however, I want to the app to still be able to focus on edittext2 to access the setError() message;

Thank you in advance.

Upvotes: 0

Views: 22

Answers (0)

Related Questions