The following three pieces of code will be called according to different versions of Android, and three are all written in.
Webview.setwebchromeclient (New Webchromeclient () {@SuppressWarnings ("unused") public void Openfilechooser ( Valuecallback<uri> uploadmsg,string accepttype,string capture) {Valuecallback = uploadmsg;intent Intent = new Intent (intent.action_get_content); intent.addcategory (intent.category_openable); Intent.settype ("image/*"); Startactivityforresult (Intent.createchooser (Intent, "complete operation Required"), 1);} @SuppressWarnings ("unused") public void Openfilechooser (valuecallback<uri> uploadmsg, String accepttype) { Valuecallback = uploadmsg;intent Intent = new Intent (intent.action_get_content); Intent.addcategory (Intent.category_ openable); Intent.settype ("image/*"); Startactivityforresult (Intent.createchooser (Intent, "complete operation Required"), 1);} @SuppressWarnings ("unused") public void Openfilechooser (valuecallback<uri> uploadmsg) {valuecallback= uploadmsg; Intent Intent = new Intent (intent.action_get_content); Intent.addcategory (intent.category_openable); Intent.settype ("image/*"); Startactivityforresult (INtent.createchooser (Intent, "complete operation Required"), 1); } @Overridepublic Boolean Onjsalert (WebView view, string URL, string message,final jsresult result) {Alertdialog.builder b 2 = new Alertdialog.builder (indexactivity.this). Settitle ("warm Tip"). Setmessage (Message). Setpositivebutton ("Confirm", new Alertdialog.onclicklistener () {@Overridepublic void OnClick (Dialoginterface dialog,int which) {result.confirm ();}}); B2.setcancelable (false); B2.create (); B2.show (); return true;});
Android WebView Control Development Click to upload Image