2011-11-21 80 views
2

我已經創建了自己的文件類型(.mmd)。 這種文件類型我已經保存了一些數據,並且希望當這種類型的文件被選中時,在我的應用程序中打開名爲openMeasurement的子活動。數據文件類型(自定義)不會打開我的應用程序

我的清單已被更改,所以活動具有以下屬性,我從另一個線程獲得了這些屬性。但它似乎不夠用

<activity android:name="OpenMeasurement"> 
     <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="http" android:host="*" 
       android:pathPattern=".*\\.mmd" /> 
      <data android:scheme="https" android:host="*" 
       android:pathPattern=".*\\.mmd" /> 
      <data android:scheme="content" android:host="*" 
       android:pathPattern=".*\\.mmd" /> 
      <data android:scheme="file" android:host="*" 
       android:pathPattern=".*\\.mmd" /> 
     </intent-filter> 
    </activity> 

我在做什麼錯誤\忘記任何人都可以幫忙嗎? - 預先感謝一堆。

編輯1:
可能是因爲我只在我的真實手機上調試,因此沒有安裝並獲取所有特定要求,真的不應該是這樣,我想就此發表幾點評論你也這麼想。 ------ EDIT3 ---好像它並註冊了「打開文件類型」在手機上,即使在「調試模式」的時候,因爲我可以爲.pdf文件

編輯2註冊它: 好吧,我試圖分裂它,刪除HTTP計劃,因爲我認爲他們沒有必要。 現在的代碼如下所示:

<activity android:name="OpenMeasurement"> 
     <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="content" /> 
      <data android:host="*" /> 
      <data android:pathPattern=".*\\.mmd" /> 
     </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:host="*" /> 
      <data android:pathPattern=".*\\.mmd" /> 
     </intent-filter> 
    </activity> 

,它仍然沒有打開,也沒有給予太多的選擇,當我選擇我的文件(使用「我的文件」)

在使用雙逃逸也嘗試在路徑模式(「。* \\。mmd」)中也沒有幫助。

編輯4: 也試圖添加:

<data android:mimetype="*/*"/> 

但仍然沒有喜悅:「 - (

回答

1

它不是在一般情況下是可行的,爲意圖機制正在與MIME類型和你只能使用預定義的MIME類型

http://code.google.com/p/android/issues/detail?id=11112

這樣:你不能讓它在本地文件EXP工作lorer,就像ASTRO一樣,因爲它可能按照ACTION_VIEW intent for a file with unknown MimeType的描述工作 - 即使用內建的MimeTypeMap。

但是,如果文件是在網絡上,如網絡瀏覽器URL開啓機構可以被截獲,如http://groups.google.com/group/android-developers/browse_thread/thread/d79bfa05528cbbee#

+0

謝謝,雖然很煩人,但我希望android可以讓我們在某個時候製作我們自己的mimetypes,這是真正需要imho的功能。 –

0

描述這個,如果你使用雙變通方法實際上是可能的。你只需雙擊十字交叉線,它就應該讓你使用該文件類型,但只有當它是一個標記40類型的angelo時,你纔可以通過簡單的下載來升級常用標記35。

相關問題