Home » Android » Open Files, Mime Type, File Extensions Problems

Open Files, Mime Type, File Extensions Problems

Posted by: admin November 1, 2017 Leave a comment


i have many problems with my app.
1. I want to make a memo app which open only files with .mem file extension. Everything i tried doesn’t work or it worked for all file extensions. What should i use/write in my manifest?

  1. When i try to open a file in my app it is only possible when its not direct in the device storage, how can i open it from everywhere?

  2. When i try to open a shared .mem file from whatsapp i get no url to the file. What i have to do there?

My current manifest intent filter:

            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.EDIT" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="file" android:mimeType="*/*" android:pathPattern="*.*\.mem" />
            <data android:scheme="content" android:mimeType="*/*" android:pathPattern="*.*\.mem" />

and so i load a file:

 if (Intent.ACTION_VIEW.equals(appLinkAction)) {
        String appLinkData = intent.getData().getPath();
        File lo = new File(appLinkData);

thats the way i share it if its necessary:

Intent intentShareFile = new Intent(Intent.ACTION_SEND);
                        intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(memo));
                        context.startActivity(Intent.createChooser(intentShareFile, "Memo teilen über..."));

I searched a lot online but nothing helped me. Hope you know what to do.
Thx for every help 😀


I found a solution, i tried everything from google and combined it and so i got the solution