WebView capturePicture - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for WebView capturePicture method.

This code example shows how to use the following methods:capturePicture
	 * @return a bitmap of the given web view 
	 *  
	 */ 
 
	private Bitmap getBitmapOfWebView(final WebView webView){
		Picture picture = webView.capturePicture();
		Bitmap b = Bitmap.createBitmap( picture.getWidth(), picture.getHeight(), Bitmap.Config.ARGB_8888);
		Canvas c = new Canvas(b);
		picture.draw(c);
		return b;
	} 
 
	/** 
	 * Returns a bitmap of a given View. 
	 *  
	 * @param view the view to save a bitmap from 
	 * @return a bitmap of the given view 
	 *  
	 */ 
 
6
CodeRank
This code example shows how to use the following methods:capturePicture
        } 
    } 
     
    public void setBitmap(WebView view)
    { 
        Picture p = view.capturePicture();
        state = Bitmap.createBitmap(p.getWidth(), p.getHeight(), Bitmap.Config.ARGB_8888);
    } 
     
    public boolean checkRenderView(WebView view)
    { 
        if(state == null)
        { 
            setBitmap(view);
            return false; 
        } 
        else 
        { 
            Picture p = view.capturePicture();
            Bitmap newState = Bitmap.createBitmap(p.getWidth(), p.getHeight(), Bitmap.Config.ARGB_8888);
6
CodeRank
This code example shows how to use the following methods:capturePicture
        } 
    } 
     
    public void setBitmap(WebView view)
    { 
        Picture p = view.capturePicture();
        state = Bitmap.createBitmap(p.getWidth(), p.getHeight(), Bitmap.Config.ARGB_8888);
    } 
     
    public boolean checkRenderView(WebView view)
    { 
        if(state == null)
        { 
            setBitmap(view);
            return false; 
        } 
        else 
        { 
            Picture p = view.capturePicture();
            Bitmap newState = Bitmap.createBitmap(p.getWidth(), p.getHeight(), Bitmap.Config.ARGB_8888);
5
CodeRank
This code example shows how to use the following methods:capturePicture
 
		public void onPageFinished(WebView view, String url) {
			Log.d("", "Loading web");
 
			// capture webview 
			Picture p = view.capturePicture();
 
		} 
	} 
 
	/** 
	 * Provides a hook for calling "alert" from javascript. Useful for debugging 
	 * your javascript. 
	 */ 
	final class MyWebChromeClient extends WebChromeClient {
		@Override 
		public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
			result.confirm();
			return true; 
		} 
3
CodeRank
This code example shows how to use the following methods:capturePicture
        final AndrRaster ret = raster(s);
		final WebView webview = new WebView(AndrPlatform.context());
		webview.setWebViewClient( new WebViewClient(){
			@Override 
			public void onPageFinished(WebView view, String url) {
				view.capturePicture();
			} 
		}); 
		 
		final Runnable runable = new Runnable(){
			private int _times = 4;
			private int DELAY = 1000;
			public void run() { 
				Canvas canvas = new Canvas( ret.bitmap() );
				canvas.drawLine(0, 0, ret.bitmap().getWidth(), ret.bitmap().getHeight(), new Paint() );
				webview.draw(canvas);
				BPlatform.instance().game().screen().refresh(); 
				_times--;
				if( _times > 0 ){
					BPlatform.instance().game().animator().post(DELAY,this);
4
CodeRank

Related WebView capturePicture Questions & Answers:

capturePicture Method Overview
This method was deprecated in API level 19. Use onDraw(Canvas) to obtain a bitmap snapshot of the WebView, or saveWebArchive(String) to save the content to a file.
See Code Examples for other Android WebView Methods: