【发布时间】:2019-08-28 22:09:09
【问题描述】:
之前问过同样的问题,我测试了所有问题,但没有一个有效。
我在一个文件中写了一个序列化对象,我命名为575454.myCustomExe
我希望我的应用程序只打开 *.myCustomExe 而不是更多。
我如何保存文件:
File file = new File(Environment.getExternalStoragePublicDirectory("MyAppFolder") , getId() + ".myCustomExe");
if (!file.exists()) {
file.getParentFile().mkdirs();
file.createNewFile();
}
ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file));
out.writeObject(serializableObject);
out.close();
我的意图过滤器:
<activity
android:name=".ui.activity.ImportActivity">
<intent-filter android:icon="@drawable/ic_save"
android:label="label"
android:priority="1">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<data android:host="*" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\.myCustomExe"/>
</intent-filter>
我也试过<data android:pathPattern=".*\\.myCustomExe" />。
【问题讨论】:
标签: android file mime-types intentfilter