gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:46:25 25 4
gpt4 key购买 nike

我正在上传一个视频并在 recyclerview 中显示进度,我们可以上传多个视频并单独显示他们的进度,如果我们更改页面或移动到 < em>app 上传应该继续(而不是停止)。

出现问题 - 在 recyclerView 中更新进度时应用程序崩溃了一段时间(recyclerView 在带有 TAB 布局 + viewPager 的 fragment 中)

我正在为它使用广播接收器

代码如下

 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();
}

逻辑猫

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

显示此错误

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}

注意:

我没有在我的应用中的任何地方使用 getSwipeableContainerViewadapter.setHasStableIds(true)

行的设计:像这样 recyclerView
Like this recyclerView row

最佳答案

尝试使用 notifyDataSetChanged() 而不是 notifyItemChanged(i)

关于android - 有时我的应用程序在更新 recyclerView 行中上传视频的进度时崩溃 -Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50869464/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com