Skip to content

Instantly share code, notes, and snippets.

View DebdeepG's full-sized avatar
🏆

DebdeepG DebdeepG

🏆
View GitHub Profile
@Tanapruk
Tanapruk / Camera2.md
Last active October 20, 2022 07:49
Camera2 API

TextureView

You need to initialize TextureView before opening a camera. TextureView is for displaying the image from camera on the device. However, you cannot use it unless the texture is ready, either because the screen is currently off or it is initializing.

You should check mTextureView.isAvailable() before opening your camera. Else you will mTextureView.setSurfaceTextureListener(). And open your camera in the callback method onSurfaceTextureListener.

Camera

Before opening your camera you should check for a camera permission first.

@HugoGresse
HugoGresse / ClearSurface API16
Created May 28, 2015 09:57
ClearSurface API16
private void clearSurface(SurfaceTexture texture) {
EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
egl.eglInitialize(display, null);
int[] attribList = {
EGL10.EGL_RED_SIZE, 8,
EGL10.EGL_GREEN_SIZE, 8,
EGL10.EGL_BLUE_SIZE, 8,
EGL10.EGL_ALPHA_SIZE, 8,
Unless specified otherwise, all of the below tinting applies to both Lollipop and pre-Lollipop using AppCompat v21.
To use the support version of these attributes, remove the android namespace.
For instance, "android:colorControlNormal" becomes "colorControlNormal".
These attributes will be propagated to their corresponding attributes within the android namespace
for devices running Lollipop. Any exceptions to this will be noted by including the "android:" prefix.
All Clickable Views:
-----------