mailto - Android Webview ERR_UNKNOWN_URL_SCHEME Error -


when click link goes mailto:admin@ikiyuzoniki.net error:

net: err_unknown_url_scheme

i tried add if(url.startswith("mailto:")) condition it's not working.

this mywebviewclient method:

public class mywebviewclient extends webviewclient {          @override         public void onpagestarted(webview view, string url, bitmap favicon) {          }          @override         public void onpagefinished(webview view, string url) {             view.setvisibility(view.visible);             final animation fade = new alphaanimation(0.0f, 1.0f);             fade.setduration(200);             view.startanimation(fade);             view.setvisibility(view.visible);          }      }     public boolean shouldoverrideurlloading(webview view, string url) {         if(url.startswith("mailto:")){             intent intent = null;             try {                 intent = intent.parseuri(url, intent.uri_intent_scheme);             } catch (urisyntaxexception e) {                 e.printstacktrace();             }             view.getcontext().startactivity(intent);         }         else if (url.endswith(".mp3")) {             intent intent = new intent(intent.action_view);             intent.setdataandtype(uri.parse(url), "audio/*");             startactivity(intent);          } else if (url.endswith(".mp4") || url.endswith(".3gp")) {             intent intent = new intent(intent.action_view);             intent.setdataandtype(uri.parse(url), "video/*");             startactivity(intent);         }         else {             return false;         }         view.reload();         return true;     } 

and how add function web view before loadurl:

... mwebview.setwebviewclient(new mywebviewclient()); ... 

try this

if(url.startswith("mailto:")){         mailto mt = mailto.parse(url);         intent = new intent(intent.action_send);         i.settype("text/plain");         i.putextra(intent.extra_email, new string[]{mt.getto()});         i.putextra(intent.extra_subject, mt.getsubject());         i.putextra(intent.extra_cc, mt.getcc());         i.putextra(intent.extra_text, mt.getbody());         mcontext.startactivity(i);         view.reload();         return true;     }  

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -