I already tried looking at this answer which answers a similar question: https://stackoverflow.com/a/31069171/6313011
I am getting this error:
"Cannot call this method while RecyclerView is computing a layout or scrolling"
In my adapter class I have a private boolean mOnBind
init to false.
Then I have
@Override
public void onBindViewHolder(RecyclerViewHolder holder, int position) {
mOnBind = true;
holder.bindRow(myList.get(position), position);
mOnBind = false;
}
And then in my RecyclerViewHolder
method I have:
myEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean focus) {
if (!mOnBind && !focus) {
notifyDataSetChanged(); //causes error!
}
}
});
I thought using the mOnBind
approach would fix the error but apparently not. How do I fix?