Code example for TextureView

Methods: getBitmap

2
    } 
 
    public void onSurfaceTextureUpdated(SurfaceTexture surface) {
        // Invoked every time there's a new Camera preview frame 
		long time0 = System.currentTimeMillis();
		mTextureView.getBitmap(bmp);
		long time1 = System.currentTimeMillis() - time0;
 
		final Canvas c = mSurfaceHolder.lockCanvas();
		if ( c != null) {
			canvas.drawText("getBmp= "  + time1, 10, 40, paint1);
			c.drawBitmap(bmp, 0, 0, null);
			mSurfaceHolder.unlockCanvasAndPost(c);
		} 
		long total = System.currentTimeMillis() - time0;
		long time2 = total -time1;
		Log.i("onSurfaceTextureUpdated", "timing: getBmp= "  + time1 + " draw= " + time2 + " total= " + total);
    } 
}