我现在面对txt文件的类似情况,并做到了这一点.

File downloadedFile= new File( context.getFilesDir(),"simple.txt" );

downloadedFile.setReadable( true,false );

downloadedFile.setWritable( true,false ); //set read/write for others

Uri downloadFileUri = Uri.fromFile( downloadedFile );

Intent intentToEditFile = new Intent( Intent.ACTION_EDIT );

intentToEditFile.setDataAndType( downloadFileUri,"text/plain" );

context.startActivity( intentToEditFile );

现在将启动’Document 2 Go’编辑器来编辑文件和

将能够编辑simple.txt

注1:应该使用设置的相同文件对象创建UrisetReadable()/ setWritable.注2:其他用户的读/写权限可能不会反映在文件中系统.有时我在adb shell中看不到rw-rw-rw-

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐