, , , .
Android- Android :
1: webviewclient URL:
- , URL- , URL-.
webview.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url){
view.loadUrl(url);
return false;
}
});
, , , , - :
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.endsWith(".mp3")) {
Uri source = Uri.parse(url);
DownloadManager.Request mp3req = new DownloadManager.Request(source);
mp3req.setDescription("Downloading mp3..");
mp3req.setTitle("song.mp3");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mp3req.allowScanningByMediaScanner();
mp3req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}
mp3req.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "song.mp3");
DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(mp3req);
}
else if(url.endsWith(".something")) {
}
else view.loadUrl(url);
return true;
}
2: :
, . , .
mWebView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
}
});
,
, WebView, WebView, WebView . hardware acceleration html5.
: SVG Android 3.0. , WebView, .
WebView : https://developer.chrome.com/multidevice/webview/overview
,