WebView element Acquisition (image download)

Source: Internet
Author: User

Encountered a problem in the project to save the picture in WebView, make a record here, directly on the code

        Mywebview.setonlongclicklistener (New View.onlongclicklistener () {@Override public Boole  An Onlongclick (view view) {final Webview.hittestresult Hittestresult = Mywebview.gethittestresult ();  WebView.HitTestResult.UNKNOWN_TYPE unknown type//WebView.HitTestResult.PHONE_TYPE phone type                 WebView.HitTestResult.EMAIL_TYPE e-mail type//WebView.HitTestResult.GEO_TYPE map type// WebView.HitTestResult.SRC_ANCHOR_TYPE hyperlink type//WebView.HitTestResult.SRC_IMAGE_ANCHOR_T YPE with linked picture type//WebView.HitTestResult.IMAGE_TYPE simple Picture type//WEBVIEW.HITTESTRESULT.E Dit_text_type selected type of text//If it is a picture type or is a type with a picture link if (hittestresult.gettype () = = WebView.H Ittestresult.image_type) {//Pop-up dialog box to save picture alertdialog.builder Builder = new Alert Dialog.builder (MywebactiviTy.this);                      Builder.settitle ("hint");                      Builder.setmessage ("Save picture to local");                          Builder.setpositivebutton ("Confirm", new Dialoginterface.onclicklistener () {@Override public void OnClick (dialoginterface dialoginterface, int i) {String URL = hittestr                              Esult.getextra ();                          Download images to local//picshowutil.downlaod (URL, mywebactivity.this);                      }                      });                          Builder.setnegativebutton ("Cancel", new Dialoginterface.onclicklistener () {//Auto dismiss                          @Override public void OnClick (dialoginterface dialoginterface, int i) {                      }                      });                      Alertdialog dialog = Builder.create ();                  Dialog.show (); } RETUrn true;   }          });

  

WebView element Acquisition (image download)

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.