0
我的應用的用戶可以使用父項和子項創建自定義列表。我將這些信息存儲在一個xml文件中。我想給用戶 分享這個文件(電子郵件等)的機會。如果其他用戶點擊此文件,我想打開該應用程序並在我的列表中顯示數據!Android分享並打開XML文件
到目前爲止我所做的: 用戶可以創建一個xml文件並將其保存在他的存儲中。 現在的問題是:如何在文件上單擊時打開應用程序?我是否必須創建自己的具有XML數據的文件擴展名?
編輯:
<activity
android:name=".activities.TrainingSimpleShowActivity"
android:label="@string/title_activity_training_simple_show"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file"
android:host="*"
android:pathPattern=".*\\.xml"
android:mimeType="*/*" />
</intent-filter>
</activity>
我在哪裏必須把意圖過濾在清單? – XxGoliathusxX
在manifest.xml中,在您想要處理數據的活動中,主要是我認爲在這種情況下。我建議你檢查文檔https://developer.android.com/guide/components/intents-filters.html –
好吧,我把它添加到我想要處理它的活動。但是當我點擊xml文件並說「打開...」時,它不會在列表中顯示我的應用程序。 – XxGoliathusxX