How to capture image from custom CameraView in Android?

try to use Surface View for creating dynamic camera view and set in your required portion. following code try variables set Class level (Global) Button btn_capture; Camera camera1; SurfaceView surfaceView; SurfaceHolder surfaceHolder; public static boolean previewing = false; Following code in onCreate() method getWindow().setFormat(PixelFormat.UNKNOWN); surfaceView = new SurfaceView(this); surfaceHolder = surfaceView.getHolder(); surfaceHolder.addCallback(this); surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); btn_capture = … Read more

What can I do when the BufferQueue has been abandoned?

What you’re doing is essentially what’s written in the TextureView docs, so it should work. The error message means that the “producer” side of the BufferQueue (the camera) grabbed a buffer, and is now trying to un-grab it (via cancelBuffer()). However, the “consumer” side (the SurfaceTexture) has gone away. Because the “consumer” side owns the … Read more

How can I set camera preview size to squared aspect ratio in a squared SurfaceView (like Instagram)

As said before you need to find the correct preview size (the one with aspect ratio 1:1) and probably you have to use FrameLayout for the SurfacePreview. It seems that you have and aspect ratio problem maybe you have the right preview size but you are placing it in an incorrect layout. Another solution might … Read more

What’s differences between Surfaceview and TextureView?

TextureView A TextureView can be used to display a content stream. Such a content stream can for instance be a video or an OpenGL scene. Example : https://github.com/dalinaum/TextureViewDemo Document: http://developer.android.com/reference/android/view/TextureView.html SurfaceView Provides a dedicated drawing surface embedded inside of a view hierarchy. Examples : http://www.mindfiresolutions.com/Using-Surface-View-for-Android-1659.php http://blog.wisecells.com/2012/06/04/surface-view-android/ Document: http://developer.android.com/reference/android/view/SurfaceView.html

Moving MapFragment (SurfaceView) causes black background flickering

Of course the proper solution will be for Google to fix the problem (see Android Maps V2 issue 4639: http://code.google.com/p/gmaps-api-issues/issues/detail?id=4639). However, one of my coworkers suggested simply extending the map beyond its container. If we extend the map fragment beyond the visible region of its container, like so: android:layout_marginLeft=”-40dp” android:layout_marginRight=”-40dp” we can reduce/eliminate the flickering. … Read more

How to draw an overlay on a SurfaceView used by Camera on Android?

SurfaceView probably does not work like a regular View in this regard. Instead, do the following: Put your SurfaceView inside of a FrameLayout or RelativeLayout in your layout XML file, since both of those allow stacking of widgets on the Z-axis Move your drawing logic into a separate custom View class Add an instance of … Read more

tech