android - Save images from website inside a WebView? -


i searched around , of answers relate images static, i.e 1 image , url pre-defined.

i have webview set take users website full of photos. want user able hold down on image , option save phone. possible? of course don't know url or because images change every day , there lot of them.

the images on website have own page if makes difference. it's website images. no authentication required. on desktop can right click , save image, can webview? there must way since it's possible in default browser.

edit: i've been using app called 'reddit fun' has function , on face of it, looks simple webview action bar presume it's possible.

i appreciate of matter.

right figured out.

using context menu can hold down on image pull it's url. can have initiate download using downloadmanager. bit self-explanatory i'll show code getting image url.

public void oncreatecontextmenu(contextmenu menu, view v, contextmenuinfo menuinfo) {     // confirm view webview     if (v instanceof webview) {                         webview.hittestresult result = ((webview) v).gethittestresult();          if (result != null) {             int type = result.gettype();              // confirm type image             if (type == webview.hittestresult.image_type || type == webview.hittestresult.src_image_anchor_type) {                 string imageurl = result.getextra();                 toast.maketext(this, imageurl, toast.length_long).show();              }         }     } } 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -