Android 如何在FileProvider中更新文件?

Android 如何在FileProvider中更新文件?,android,Android,找不到如何更新文件或将文件插入文件提供程序的任何文档 任何尝试都以java.lang.UnsupportedOperationException结束 Uri photoURI = FileProvider.getUriForFile(this, "com.MyApp.fileprovider", file); ContentValues values = new ContentValues(); values.pu

找不到如何更新文件或将文件插入文件提供程序的任何文档

任何尝试都以java.lang.UnsupportedOperationException结束

Uri photoURI = FileProvider.getUriForFile(this,
                    "com.MyApp.fileprovider",
                    file);

ContentValues values = new ContentValues();
values.put("my_images", byteArray);
getContentResolver().update(photoURI,values,null,null);
--

找不到如何更新文件或将文件插入文件提供程序的任何文档

你没有。您可以使用普通Java文件I/O创建或更新文件。
FileProvider
仅在第三方应用程序需要时提供这些文件

在您的特定情况下,使用
FileOutputStream
byteArray
写入
文件
,假设
文件
是您要创建或更新的文件

Caused by: java.lang.UnsupportedOperationException: No external updates                                                                   
at android.support.v4.content.FileProvider.update(FileProvider.java:503)
at android.content.ContentProvider$Transport.update(ContentProvider.java:368)
at android.content.ContentResolver.update(ContentResolver.java:1415)