mDownloadListener = new BrowserDownloadListener() { public void onDownloadStart(final String url,final String userAgent, final String contentDisposition,final String mimetype,final String referer, final long contentLength) { String fileName = url.substring(url.lastIndexOf("/") + 1, url.length()); new AlertDialog.Builder(mContext). setTitle(mContext.getResources().getString(R.string.dialog_download_title)). setMessage(mContext.getResources() .getString(R.string.dialog_download_message,fileName,MoKeeUtils.formatFileSize(contentLength))). setPositiveButton(mContext.getResources().getString(R.string.ok), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (which == DialogInterface.BUTTON_POSITIVE) { mWebViewController.onDownloadStart(Tab.this, url, userAgent, contentDisposition, mimetype, referer, contentLength); } } }).setNegativeButton(mContext.getResources().getString(R.string.cancel), null).create().show(); } };参见:Mokee
在Tab.java内实现BrowserDownloadListener方法