android - How differentiate between user input and setText method in TextWatcher? -
i'm using recyclerview
contains items containing edittext
each one.
i add textwatcher
in edittext in viewholder constructor. text watcher call: adapter.notifyitemchanged()
when bind views, do:
edittext.settext("value");
so text changed event fired, don't want beacuse get
java.lang.illegalstateexception: cannot call method while recyclerview computing layout or scrolling
i want event fired when user changes text manually. there way differentiate events?
i remove , add again textwatcher
each time views binded i'd find better solution.
instead of setting textwatcher in viewholder constructor, can while binding view, right after settext() call, avoiding problem experiencing.
so:
edittext.settext("value"); edittext.settextwatcher(new textwatcher(..
this way textwatcher not fire event because didn't yet exist when initial value set.
Comments
Post a Comment