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?
. How to make it so that when yo...">
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
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.
Source: https://ru.stackoverflow.com/questions/433443/
All Articles