2017-08-16 84 views
0

无法找到任何文件如何更新文件或插入文件到FileProvider。如何更新FileProvider中的文件?

任何尝试以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); 

-

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) 

回答

1

无法找到任何文件如何更新文件或插入文件FileProvider。

你不知道。您使用普通的Java文件I/O创建或更新文件FileProvider仅使它们可以根据需要提供给第三方应用程序。

你的具体情况,使用FileOutputStreambyteArrayfile,假设file是要创建或更新的文件。