@Override
 public boolean shouldOverrideUrlLoading(WebView view, String url) {
   if (url.startsWith("file")) {
     // Keep local assets in this WebView.
     return false;
   } else if (url.startsWith("mailto:")) {
     try {
       MailTo mt = MailTo.parse(url);
       Intent i = new Intent(Intent.ACTION_SEND);
       i.setType("message/rfc822");
       i.putExtra(Intent.EXTRA_EMAIL, new String[] {mt.getTo()});
       i.putExtra(Intent.EXTRA_SUBJECT, mt.getSubject());
       context.startActivity(i);
       view.reload();
     } catch (ActivityNotFoundException e) {
       Log.w(TAG, "Problem with Intent.ACTION_SEND", e);
       new AlertDialog.Builder(context)
           .setTitle("Contact Info")
           .setMessage("Please send your feedback to: [email protected]")
           .setPositiveButton(
               "Done",
               new DialogInterface.OnClickListener() {
                 public void onClick(DialogInterface dialog, int which) {
                   Log.d("AlertDialog", "Positive");
                 }
               })
           .show();
     }
     return true;
   } else {
     // Open external URLs in Browser.
     startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
     return true;
   }
 }
Ejemplo n.º 2
0
  protected void processCallBackUrl(String var1) {
    if (this.progressBar != null) {
      this.progressBar.setVisibility(0);
    }

    if (var1.contains("rtsp://")) {
      Intent var4 = new Intent("android.intent.action.VIEW", Uri.parse(var1));
      var4.setFlags(1073741824);
      this.startActivity(var4);
    } else if (var1.startsWith("mailto:")) {
      MailTo var3 = MailTo.parse(var1);
      Intent var2 = new Intent("android.intent.action.SEND");
      var2.setType("text/plain");
      var2.putExtra("android.intent.extra.EMAIL", new String[] {var3.getTo()});
      var2.putExtra("android.intent.extra.SUBJECT", var3.getSubject());
      var2.putExtra("android.intent.extra.CC", var3.getCc());
      var2.putExtra("android.intent.extra.TEXT", var3.getBody());
      this.startActivity(var2);
    } else {
      this.currentUrl = var1;
      this.webView.loadUrl(var1);
    }
  }