List of usage examples for android.media ImageReader acquireNextImage
public Image acquireNextImage()
Acquire the next Image from the ImageReader's queue.
From source file:com.andrasta.dashi.MainActivity.java
@Override public void onImageAvailable(@NonNull ImageReader reader) { Preconditions.assertParameterNotNull(reader, "reader"); if (saveImageOnDisk.getAndSet(false)) { imageSaver.saveToFile(reader.acquireNextImage(), imageDestination); Toast.makeText(this, "Image saved to " + imageDestination.getAbsolutePath(), Toast.LENGTH_SHORT).show(); return;/* w ww . j a va2 s. co m*/ } try { alprHandler.recognize(reader.acquireNextImage()); } catch (IllegalStateException e) { Log.w(TAG, "Error on acquireNextImage"); } }
From source file:com.android.camera2.its.ItsService.java
private ImageReader.OnImageAvailableListener createAvailableListenerDropper(final CaptureCallback listener) { return new ImageReader.OnImageAvailableListener() { @Override/*w w w .j av a2 s .com*/ public void onImageAvailable(ImageReader reader) { Image i = reader.acquireNextImage(); i.close(); } }; }
From source file:com.android.camera2.its.ItsService.java
public ImageReader.OnImageAvailableListener createAvailableListener(final CaptureCallback listener) { return new ImageReader.OnImageAvailableListener() { @Override/*from w ww. jav a 2 s . c o m*/ public void onImageAvailable(ImageReader reader) { Image i = null; try { i = reader.acquireNextImage(); listener.onCaptureAvailable(i); } finally { if (i != null) { i.close(); } } } }; }