android2013. 7. 1. 09:03

private class MyWebClient extends WebViewClient {

  public boolean shouldOverrideUrlLoading(WebView view, String overrideUrl) {

   if(overrideUrl.startsWith("http://")){

    return false;

   }

   else {

    boolean override = false;

    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(overrideUrl));

    intent.addCategory(Intent.CATEGORY_BROWSABLE);

    intent.putExtra(Browser.EXTRA_APPLICATION_ID, getPackageName());

    if (overrideUrl.startsWith("sms:")) {

     Intent i = new Intent(Intent.ACTION_SENDTO, Uri.parse(overrideUrl));

     startActivity(i);

     return true;

    }

    if (overrideUrl.startsWith("tel:")) {

     Intent i = new Intent(Intent.ACTION_CALL, Uri.parse(overrideUrl));

     startActivity(i);

     return true;

    }

    if (overrideUrl.startsWith("mailto:")) {

     Intent i = new Intent(Intent.ACTION_SENDTO, Uri.parse(overrideUrl));

     startActivity(i);

     return true;

    }

    try{

     startActivity(intent);

     override = true;

    }

    catch(ActivityNotFoundException ex) {}

    return override;

   }

  }

 };



하나씩 다 지정 해줘야 함.. 물론 권한도 포함해서요~;)


전화걸기 권한

<uses-permission android:name="android.permission.CALL_PHONE" /> 



출처 :  http://titis.tistory.com/entry/%EC%9B%B9%EB%B7%B0WebView-%EC%95%88%EC%97%90%EC%84%9C-tel-%EB%B0%8F-sms-mailTo-%ED%83%9C%EA%B7%B8-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0

Posted by 광포한곰돌이