Error message -> shouldOverrideUrlLoading Webview Android -


i need solved problem webview , method shouldoverrideurlloading.

i want display message indicating user doesn't have twitter app installed on phone

     @override       public boolean shouldoverrideurlloading(webview view, string url) {             if (url.startswith("tel:")) {                  intent intent = new intent(intent.action_dial,                         uri.parse(url));                  startactivity(intent);          }else if(url.startswith("http:") || url.startswith("https:")) {             view.loadurl(url);         }else if (url != null && url.startswith("market://")) {                 view.getcontext().startactivity(                     new intent(intent.action_view, uri.parse(url)));                 return true;         } else if (url != null && url.startswith("twitter://")) {                 view.getcontext().startactivity(                     new intent(intent.action_view, uri.parse(url)));                 return true;         }else{     toast.maketext(getapplicationcontext(), "twitter app necessary", toast.length_short).show();       }             return false;

}

the error show "the application has stopped unexpectedly. please try again"

can help?

there seems problem twitter intent. far understood want twitter app post something. consult api's how launch twitter app using intent. prevent crashes might following:

 else if (url != null && url.startswith("twitter://")) {             try{             view.getcontext().startactivity(                 new intent(intent.action_view, uri.parse(url)));              } catch(activitynotfoundexception e){                // stuff here, example load twitter url in browser              }             return true; 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -