after you delve into dozens of questions about how to associate a user file with my application, I have to ask the final question: how to add the mime type using FileOutputStream?
I will try to explain: my application writes "lorenzoff" files, it is false, but say, without any extension. I know that Android uses the mime type and itβs fine, I figured it out and I added this intent filter to my manifest
<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:host="" android:scheme="file" android:mimeType="application/wtf" /> </intent-filter>
Now, I want to create my new files with their contents, say
DataOutputStream os = new DataOutputStream(new FileOutputStream("lorenzoff")); os.writeInt(1); os.writeInt(2); os.writeInt(3); os.close();
Checking the newly created file with the application for viewing the file system (Astro), I see that it does not have the mime type, and we arrived, I can not view it in my application (it has no association).
Question: how to write mime type so that I can read "application / wtf", checking file properties?
Thank you in advance
source share