When a position scrolled from not visible to a visible position, onBindViewHolder will not be called all the time, if the associated view is not recycled yet.
Yet, sometimes, we still need to perform some action when a view just become visible. For instance, requestFocus, to restore back previous EditText focus.
When a position scrolled from not visible to a visible position, onBindViewHolder will not be called all the time, if the associated view is not recycled yet.
Yet, sometimes, we still need to perform some action when a view just become visible. For instance,
requestFocus
, to restore back previous EditText focus.It can also be used to handle situation like this - https://stackoverflow.com/questions/54833004/long-pressed-broken-for-edittext-or-android-support-v7-widget-appcompatedittext/54840825#54840825
Having
onViewAttachedToWindow
is great. (This can be used as a reasonable signal that the view is about to be seen by the user...)