step1: 编写分享代码, 将Uri的生成方式改为由FileProvider提供的临时授权路径,并且在intent中添加flag 注意:在Android7.0之后,调用系统分享,传入URI的时候可能会导致程序闪退崩溃.这是由于7.0的新的文件权限导致的.下面的代码对其做了处理 public static int sharePic(Context context, String picFilePath) { File shareFile = new File(picFilePath); if (
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.InteropServices; public static partial class ConsoleManager { private static readonly ConsoleCtrlDelegate Console
private static final int PHOTO_REQUEST_TAKEPHOTO = 1;// 拍照 private static final int PHOTO_REQUEST_GALLERY = 2;// 从相册中选择 private static final int PHOTO_REQUEST_CUT = 3;// 结果 private File tempFile = new File(Environment.getExternalStorageDirectory(), g