2012-01-29 110 views
1

我有布局与webView。在我的活动中,我从我的服务器加载我的页面。页面包含以下链接:如何处理自定义协议?

<a href="(custom or http)://load_1">Load 1</a> 
<a href="(custom or http)://load_2">Load 2</a> 

我想加载具体的活动取决于点击链接。怎么做?

+1

这是http://stackoverflow.com/questions/4846296/android-sdk-webview-call-activity – 2012-01-29 11:08:46

回答

0

在清单中创建一个指向所需活动的元素,然后创建一个指定您的规则的适当的元素。例如:

<activity android:label="@string/app_name" 
      android:name="URLHandler"> 
    <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.this-so-does-not-exist.com" android:path="/something" /> 
    </intent-filter> 
</activity>