注册打开的txt文件

时间:2015-11-10 20:05:13

标签: android file action

我想有一些动作,在每个文件打开时都有效。在我的情况下 - * .txt文件。我需要得到这个文件的名称。

我找到了一些东西:

Intent.ACTION_VIEW
Intent.ACTION_GET_CONTENT

但如何使用它们? 我的猜测:

<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.ACTION_OPEN_DOCUMENT" />

放到我的接收器

以及服务的部分代码:

File aFile = new File(filePath);
FileWriter fOut = new FileWriter(aFile, true);
if(Intent.ACTION_VIEW.contains(".txt")) fOut.append("DOC " + time1 + " " + date1 + "\n");

请给我一个提示,如何击败这个。非常感谢。

0 个答案:

没有答案