2014-03-06 147 views
2

我在清單文件中爲我的一項活動定義了一個意圖過濾器。 當我想開始從亞行外殼本次活動,請使用以下命令:開始活動時出錯

$亞行外殼上午開始

-W -a android.intent.action.VIEW 

    -d "example://gizmos" com.example.android 

我收到以下錯誤:

首發:意向{ ACT = android.intent.action.VIEW DAT = http://www.example.com/gizmos PKG = com.example.android}

錯誤:活動還沒開始,無法解決意向{行動= android.intent.action.VIEW DAT = http://www.example.com/gizmos FLG = 0x100的00000 pkg = com.example.android}

請幫忙。

這裏是清單項:

<activity 

     android:name="com.example.android.activity.ExampleActivity" 

     android:configChanges="orientation|keyboardHidden|screenSize" 

     android:screenOrientation="portrait" > 

     <intent-filter android:label="Search" > 

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



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

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

      <!-- Accepts URIs that begin with "example://gizmos」 --> 

      <data 

       android:host="gizmos" 

       android:scheme="example" /> 

      <!-- Accepts URIs that begin with "http://www.example.com/gizmos」 --> 

      <data 

       android:host="www.example.com" 

       android:pathPrefix="gizmos" 

       android:scheme="http" /> 

     </intent-filter> 

    </activity> 

回答

6

編輯您的AndroidManifest.xml如下:

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

<!-- Accepts URIs that begin with "example://gizmos」 --> 
<data 
    android:host="gizmos" 
    android:scheme="example" /> 
</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" /> 

<!-- Accepts URIs that begin with "http://www.example.com/gizmos」 --> 
<data 
    android:host="www.example.com" 
    android:pathPrefix="gizmos" 
    android:scheme="http" /> 
</intent-filter> 
+0

我已經使用了類似的XML。但同樣的錯誤。 –