Build basic browser with Sketchware [part #1]
All codes used in my tutorial Enable
Video tutorial :
Enable Download :
webview1.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } });
Progress Bar :
final android.widget.ProgressBar prog = new android.widget.ProgressBar(this,null, android.R.attr.progressBarStyleHorizontal);
prog.setPadding(0,0,0,0);
prog.setIndeterminate(false);
prog.setFitsSystemWindows(true);
prog.setProgress(0);
prog.setScrollBarStyle(android.widget.ProgressBar.SCROLLBARS_OUTSIDE_INSET);
prog.setMax(100);
ViewGroup.LayoutParams vlp = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
prog.setLayoutParams(vlp);
pl.addView(prog);
webview1.setWebChromeClient(new WebChromeClient() {
@Override public void onProgressChanged(WebView view, int newProgress) {
prog.setProgress(newProgress);
}
});
Video tutorial :
Comments
Post a Comment