With the simple code below I can get my url loaded correctly, but, I get >”ERR_UNKNOWN_URL_SCHEME”
when trying to tap on html links that start with mailto: whatsapp: and tg: (Telegram). Anyone can help me to fix this please? Unfortunately I do not know Java at all.
public class MainActivity extends AppCompatActivity { private WebView mywebView;`
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mywebView=(WebView) findViewById(R.id.webview);
mywebView.setWebViewClient(new WebViewClient());
mywebView.loadUrl("https://masteravkusa.tilda.ws/");
WebSettings webSettings=mywebView.getSettings();
webSettings.setJavaScriptEnabled(true);
}
@Override
public void onBackPressed(){
if(mywebView.canGoBack()) {
mywebView.goBack();
}
else{
super.onBackPressed();
}
}
}
New contributor
Semyon__Ykt DIGYN is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.