I have a web page with a link like <a href="..."/> .

How to make it so that when you click on it, the phone's contact list opens?

    2 answers 2

    Need to override WebViewClient

     private class Client extends WebViewClient{ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { if(url.contains("ваша ссылка")){ Intent intent= new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivity(intent); } return super.shouldOverrideUrlLoading(view, url); } } 

    When webView is initialized, assign it to webView.setWebViewClient(new Client());

    If the contact is selected then call startActivityForResult

    • I used your way. Everything works great, thanks. - Naratzul Arantheal
    • Yes on health) - SorryForMyEnglish

    Add this filter to the manifest in the activit:

     <intent-filter> <action android:name="android.intent.action.VIEW"></action> <category android:name="android.intent.category.DEFAULT"></category> <category android:name="android.intent.category.BROWSABLE"></category> <data android:host="www.youtube.com" android:scheme="http"></data> </intent-filter> 

    At the same time, your activation will be launched when you click on the link www.youtube.com. And then you can already show a book of contacts.