本文整理了Java中android.webkit.WebView.setDownloadListener()
方法的一些代码示例,展示了WebView.setDownloadListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.setDownloadListener()
方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:setDownloadListener
暂无
代码示例来源:origin: Justson/AgentWeb
@Override
public WebListenerManager setDownloader(WebView webView, DownloadListener downloadListener) {
webView.setDownloadListener(downloadListener);
return this;
}
代码示例来源:origin: JZ-Darkal/AndroidHttpCapture
WebView.setWebContentsDebuggingEnabled(true);
webView.setDownloadListener(new MyWebViewDownLoadListener());
webView.setWebViewClient(new WebViewClient() {
代码示例来源:origin: TheFinestArtist/FinestWebView-Android
webView.setDownloadListener(downloadListener);
代码示例来源:origin: burgessjp/GanHuoIO
private static void settWebViewDownloadListener(final WebView webView) {
webView.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
webView.getContext().startActivity(intent);
}
});
}
}
代码示例来源:origin: luili16/UIMocker
@Override
public void setDownloadListener(Object listener) {
mWebView.setDownloadListener((DownloadListener) listener);
}
代码示例来源:origin: stackoverflow.com
private class WVClient extends WebViewClient implements DownloadListener {
@Override
public boolean shouldOverrideUrlLoading(WebView v, String u) {
v.loadUrl(u);
v.setDownloadListener(this);
return true;
}
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
Log.i(TAG, "Download: " + url);
Log.i(TAG, "Length: " + contentLength);
}
}
代码示例来源:origin: stackoverflow.com
{
setContentView(R.layout.activity_main);
WebView ourBrow = (WebView) findViewById(R.id.webviewapkapps);
ourBrow.setWebViewClient(new OurViewClient());
ourBrow.loadUrl("http://websitename .com");
ourBrow.getSettings().setJavaScriptEnabled(true);
ourBrow.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}
}
代码示例来源:origin: AndroidHensen/YaNi
@Override
public void initListener() {
wv.setWebViewClient(new MyWebViewClient());
wv.setWebChromeClient(new MyWebChromeClient());
wv.setDownloadListener(new MyDownLoadListener());
}
代码示例来源:origin: stackoverflow.com
public class webActivity extends Activity {
WebView webView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
this.webView=(WebView) this.findViewById(R.id.webview);
this.webView.getSettings().setSupportZoom(false);
this.webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
this.webView.loadUrl("http://www.sm.ividhya.com/j128/");
this.webView.setWebViewClient(new WebViewClientDemo());
webView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
startActivity(intent);
}
});
}
private class WebViewClientDemo extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
代码示例来源:origin: stackoverflow.com
WebView myWebView = (WebView) findViewById(R.id.helpview);
showDialog();
myWebView.setWebViewClient(new WebViewClient());
myWebView.loadUrl(url);
myWebView.getSettings().setJavaScriptEnabled(false);
myWebView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
dismissDialog();
}
});
myWebView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
Bundle extras = getIntent().getExtras();
String v = extras.getString("v");
v = v.replace(".", "-");
Log.i("File", v);
File loc = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
Log.i("File", loc.toString() + "/ind-" + v + ".apk");
install(loc.toString() + "/ind-" + v + ".apk");
}
});
代码示例来源:origin: hymanme/MaterialHome
webView.setDownloadListener(new MyWebViewDownLoadListener());
webView.loadUrl(url);
代码示例来源:origin: bkhezry/ExtraWebView
mWebView.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
代码示例来源:origin: zfman/hputimetable
settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
webView.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent,
代码示例来源:origin: yll2wcf/book
mWebView.setDownloadListener(new MyWebViewDownLoadListener());
代码示例来源:origin: mnnyang/ClassSchedule
mWebView.setDownloadListener(new DownloadListener() {
@Override
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
代码示例来源:origin: leelit/STUer-client
mWebView.setDownloadListener(new MyWebViewDownLoadListener());
代码示例来源:origin: stackoverflow.com
webView.setDownloadListener(new DownloadListener()
代码示例来源:origin: stackoverflow.com
void webview() {
private WebView wv;
WebView webView = (WebView) findViewById(R.id.webView);
webView.loadUrl(httpResultWebView);
WebSettings settings = webView.getSettings();
settings.setBuiltInZoomControls(true);
settings.getAllowContentAccess();
settings.getJavaScriptEnabled();
settings.setUseWideViewPort(true);
settings.setLoadWithOverviewMode(true);
webView.setWebViewClient(new WebViewClient());
wv = webView;
wv.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
String fileName = URLUtil.guessFileName(url, contentDisposition, mimetype);
DownloadManager.Request request = new DownloadManager.Request(
Uri.parse(url));
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir("/Library", fileName);
DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
dm.enqueue(request);
}
});
}
代码示例来源:origin: AmniX/AdBlockedWebView-Android
mWebView.setDownloadListener(this);
mWebView.setOnCreateContextMenuListener(this);
代码示例来源:origin: kebernet/shortyz
mWebView.setDownloadListener(mPDL);
内容来源于网络,如有侵权,请联系作者删除!