当前位置: 代码迷 >> 综合 >> Android: Intent.ACTION_SEND分享文件
  详细解决方案

Android: Intent.ACTION_SEND分享文件

热度:80   发布时间:2024-01-29 09:05:25.0
  /*** 共有file**/private fun toShare(file: File) {val builder = VmPolicy.Builder()StrictMode.setVmPolicy(builder.build())var intent = Intent(Intent.ACTION_SEND)//二进制的方式传输intent.type = "application/octet-stream"intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file))intent = Intent.createChooser(intent, " ")activity?.startActivity(intent)}

 

  相关解决方案