открытие .mht файла в проводнике - PullRequest
0 голосов
/ 29 апреля 2020

Я использую это, чтобы открыть сохраненные автономные файлы .mht страницы в моем веб-браузере.

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

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="file" />
            <data android:mimeType="multipart/related" />
            <data android:mimeType="text/html" />
            <data android:mimeType="application/xhtml+xml" />
            <data android:mimeType="application/vnd.wap.xhtml+xml" />
            <data android:mimeType="application/rss+xml" />
            <data android:mimeType="application/atom+xml" />
            <data android:mimeType="application/xml" />
            <data android:mimeType="text/xml" />
            <data android:mimeType="application/x-bittorrent" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="*"
                android:scheme="file" />
            <data android:pathPattern=".*\\.torrent" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="file" />
            <data android:scheme="content" />
            <data android:host="*" />
            <data android:pathPattern="/.*\\.mhtml" />
            <data android:pathPattern="/.*\\.mht" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data android:scheme="file" />
            <data android:scheme="content" />
            <data android:host="*" />
            <data android:mimeType="*/*" />
            <data android:pathPattern="/.*\\.mhtml" />
            <data android:pathPattern="/.*\\.mht" />
        </intent-filter>

, но проблема в том, что если я открываю файл из ES File Explorer, мой веб-браузер открывается внутри File Explorer. с отображаемой страницей.

если я открываю файл из проводника файлов с помощью веб-браузера U C, он открывается отдельно.

что делать при открытии файла .mht из проводника файлов в быть открытыми отдельно.

вот как это выглядит

проблема

ожидаемый результат

1 Ответ

1 голос
/ 29 апреля 2020

Попробуйте изменить android:launchMode в манифесте для вашей активности на "singleTask" или "singleInstance" (режим по умолчанию - "стандартный").

    <activity android:name=".MyActivity"
              android:launchMode="singleTask">
    ...
   </activity>

См. https://developer.android.com/guide/topics/manifest/activity-element?hl=ru#lmode

и https://developer.android.com/guide/components/activities/tasks-and-back-stack

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...