1. Are you ready for the Galaxy S20? Here is everything we know so far!

tel:12345678 Not working in webview. plz help

Discussion in 'Android Development' started by jack786, Mar 3, 2016.

  1. jack786

    jack786 Lurker
    Thread Starter

    Hello all this is my first post

    below is my code... its not working... what wrong? plz help

    What is wrong with my code. why still not working?

    public class HomeActivity extends Activity {

    WebView wv;

    @override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    wv=(WebView)findViewById(R.id.webView);
    wv.setWebViewClient(new WebViewClient());
    wv.loadUrl("http://myweb.com");
    WebSettings ws= wv.getSettings();
    ws.setJavaScriptEnabled(true);
    wv.setWebChromeClient(new WebChromeClient());
    }


    public boolean shouldOverrideUrlLoading(WebView wv, String url) {
    if (url.startsWith("tel:")) {
    Intent intent = new Intent(Intent.ACTION_CALL);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
    intent.setData(Uri.parse(url));
    startActivity(intent);
    }else if (url.startsWith("http:") || url.startsWith("https:")) {
    wv.loadUrl(url);
    }
    return true;
    }
    }
     


Loading...

Share This Page

Loading...