Gents,Nhiều tập tin mở rộng/Mimetype ý-bộ lọc với một hoạt động
Tôi đang cố gắng để có được nó để ứng dụng Android của tôi có thể đáp ứng tất cả các tập tin được mở (thông qua phù hợp với phần mở rộng của họ) và mime-loại (vì vậy họ sẽ làm việc từ trình duyệt).
Tôi đã làm theo lời khuyên ở đây:
Android intent filter for a particular file extension?
nhưng vẫn không có may mắn.
Các phần có liên quan từ file manifest android của tôi là như sau:
<activity android:name="MuPDFActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="application/vnd.ms-xpsdocument"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="application/pdf"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="application/x-cbz"/>
</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:mimeType="*/*"/>
<data android:pathPattern=".*\\.xps"/>
<data android:host="*"/>
</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:mimeType="*/*"/>
<data android:pathPattern=".*\\.pdf"/>
<data android:host="*"/>
</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:mimeType="*/*"/>
<data android:pathPattern=".*\\.cbz"/>
<data android:host="*"/>
</intent-filter>
</activity>
Như bạn thấy, tôi muốn ứng dụng được gọi cho .pdf, .xps, và các tập tin .cbz, cũng file với các mimetypes có liên quan. Các thử nghiệm cục bộ ở đây dường như gợi ý rằng các phần .pdf và application/pdf đều hoạt động, nhưng hãy thử như tôi có thể, các phần .xps (và có lẽ .cbz) thì không.
Tôi có thiếu điều gì đó hiển nhiên ở đây không? Mỗi Hoạt động có thể chỉ có một mẫu mimetype/tệp không?
Mọi trợ giúp sẽ được đánh giá cao.
Cảm ơn,
Robin
Phiên bản Android nào? Tôi lưu ý rằng có sự khác biệt ở đây.Xem câu hỏi của tôi: http://stackoverflow.com/questions/20650378/how-did-intent-filter-change-from-android-2-to-android-4 – Martin