Code example for Camera

Methods: setPreviewTexturestartPreview

    public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
        mCamera =;
        try { 
        } catch (IOException t) {
            android.util.Log.e("TextureView", "Cannot set preview texture target!", t);
    public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
        // Ignored, the Camera does all the work for us 
    public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
Stop searching for code, let great code find you!  Add Codota to your java IDE