1. Download our Official Android App: Forums for Android!

Apps tel:12345678 Not working in webview. plz help

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

  1. jack786

    jack786 Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    Mar 3, 2016

    Mar 3, 2016
    1
    0
    5
    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;
    }
    }
     

    Advertisement

  2. LV426

    LV426 I say we take off and nuke this place from orbit
    Recognized Developer
    Rank:
     #12
    Points:
    1,988
    Posts:
    9,176
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    9,176
    13,681
    1,988
    Male
    Software developer
    South West of England

Share This Page

Loading...