Android: Intent.ACTION_SEND分享文件
16lz
2021-01-23
/** * 共有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) }
更多相关文章
- android点击事件的四种方式
- android各种图片获取路径的方式
- Android 以友好的方式显示时间
- CollapsingToolbarLayout标准使用方式
- Android 退出程序方式——再按一次退出
- android 使用post方式上传文件
- android 判断耳机是否插入的几种方式