我現在面對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-