簡體   English   中英

如何從活動中更新Android清單中意圖過濾器中數據標簽的路徑前綴屬性?

[英]How can I update path prefix attribute of data tag in intent filter in android manifest from activity?

這是清單的片段。 我想將字符串傳遞給活動中pathPrefix中的查詢參數'id'。 我怎么做?

    <activity
        android:name=".MainActivity"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:screenOrientation="portrait" >
        <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="www.myHost.com" android:pathPrefix="/video?id="/>
        </intent-filter>
    </activity>

好吧,我已經解決了使用

android:pathPattern="/.*"

在數據標簽中,代替pathPrefix,並按以下方式獲取查詢:

Uri uri = intent.getData();
String videoId = uri.getQueryParameter("id");

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM