以下のコードを使用して、他のアプリケーションを呼び出すことによって.docファイルを開きます。
しかし、私はファイルを変更したくありません。
私はファイルを読み取り専用に設定します。
他の方法でユーザーがファイルを変更しないようにする方法。
ファイル形式は* .doc、* .docx、* .ppt、* .pptx、* .pdf、* .txtのいずれかです。例えば、容易に入手可能なファイルマネージャのアプリ -Androidで文書を読み取り専用にする
File file = new File(FilePath);
String mimetype = ".doc\tapplication/msword";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), mimetype);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);