有些时候我的应用程序崩溃了,同时更新了在recyclerView行-Android中上传视频的进度

Mr.*_* Ad 12 crash android inotifypropertychanged android-recyclerview

我正在上传视频并显示进度recyclerview,我们可以上传多个视频并单独显示其进度,如果我们更改页面或进入应用程序上传应继续(不停止).

问题发生 - 应用程序在更新进度时崩溃了一段时间recyclerView(recyclerView在使用TAB布局+ viewPager的片段中)

我正在使用广播接收器

代码如下

 try {
        for (int i = 0; i < postList.size(); i++) {
            if (postList.get(i).getId().equals(postId)) {
                postList.get(i).setProgress(result.getProgress());
                profileListAdapter.notifyItemChanged(i);
            }
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
Run Code Online (Sandbox Code Playgroud)

logcat的

Fatal Exception: java.lang.IllegalArgumentException: Tmp detached view should be removed from RecyclerView before it can be recycled: ViewHolder{cc90564 position=1 id=-1, oldPos=-1, pLpos:-1 update tmpDetached no parent}
   at android.support.v7.widget.RecyclerView$Recycler.recycleViewHolderInternal(RecyclerView.java:5238)
   at android.support.v7.widget.RecyclerView.removeAnimatingView(RecyclerView.java:1198)
   at android.support.v7.widget.RecyclerView$ItemAnimatorRestoreListener.onAnimationFinished(RecyclerView.java:10834)
   at android.support.v7.widget.RecyclerView$ItemAnimator.dispatchAnimationFinished(RecyclerView.java:11334)
   at android.support.v7.widget.SimpleItemAnimator.dispatchAddFinished(SimpleItemAnimator.java:289)
   at android.support.v7.widget.DefaultItemAnimator$5.onAnimationEnd(DefaultItemAnimator.java:242)
   at android.support.v4.view.ViewPropertyAnimatorCompatJB$1.onAnimationEnd(ViewPropertyAnimatorCompatJB.java:47)
   at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1114)
   at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239)
   at android.animation.ValueAnimator.cancel(ValueAnimator.java:1140)
   at android.view.ViewPropertyAnimator.cancel(ViewPropertyAnimator.java:427)
   at android.support.v4.view.ViewPropertyAnimatorCompatICS.cancel(ViewPropertyAnimatorCompatICS.java:102)
   at android.support.v4.view.ViewPropertyAnimatorCompat$ICSViewPropertyAnimatorCompatImpl.cancel(ViewPropertyAnimatorCompat.java:464)
   at android.support.v4.view.ViewPropertyAnimatorCompat.cancel(ViewPropertyAnimatorCompat.java:1063)
   at  
Run Code Online (Sandbox Code Playgroud)

显示此错误

java.lang.IllegalArgumentException: Tmp detached view should be removed from RecyclerView before it can be recycled: 
ViewHolder{cc90564 position=1 id=-1, oldPos=-1, pLpos:-1 update tmpDetached no parent}
Run Code Online (Sandbox Code Playgroud)

注意:

我不会在我的应用程序中使用的任何地方getSwipeableContainerViewadapter.setHasStableIds(true).

行设计:

喜欢这一recyclerView

Roy*_*fin 3

尝试notifyDataSetChanged()代替notifyItemChanged(i).