Android WebView Control Development Click to upload Image

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.