1

I have layout with webView. In my activity I loads my page from my server. Page contains links like:

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

I want to load specific activity depending on the clicked link. How to do it?

Nips
  • 13,162
  • 23
  • 65
  • 103

1 Answers1

0

Create an element in the manifest pointing to the activity you want, and then create an appropriate that specifies your rules. For example:

<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>
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491