小编Mr.*_* Ad的帖子

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

我正在上传视频并显示进度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 …
Run Code Online (Sandbox Code Playgroud)

crash android inotifypropertychanged android-recyclerview

12
推荐指数
1
解决办法
732
查看次数

Android : 对于通话和发送短信 Intent 需要添加权限吗?

当用户点击通话和短信按钮时,我正在处理通话和短信意图。

题:

1)需要在AndroidManifest.xml文件中添加权限?

2) 还需要为运行时权限编码吗?

我为呼叫意图编写代码如下:

 Intent intent = new Intent(Intent.ACTION_DIAL);
                intent.setData(Uri.parse("tel:" + driverMobileNo));
                startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

短信意向

Intent it = new Intent(Intent.ACTION_SENDTO, Uri.parse("smsto:"+ driverMobileNo));
            it.putExtra("sms_body", "The SMS text");
            startActivity(it);
Run Code Online (Sandbox Code Playgroud)

上面的代码工作正常(在 Oreo 8.0 版本中测试),无需在 AndroidManifest.xml 和运行时添加权限。

sms android call android-intent

2
推荐指数
1
解决办法
3285
查看次数