I would like to implement an Image Reader but it blocks at the first image reading.
I really don't know how to unlock the situation.
Surface processSurface = reader.getSurface();
surfaces.add(processSurface);
recordRequestBuilder.addTarget(processSurface);
reader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() {
@Override
public void onImageAvailable(ImageReader reader) {
Log.v("ImageReader","Reading");
//I want to do a process on the image here, but i don't want to
//block my UI
}
},null);
I don't understand, if I write reader.aquireLatestImage
or reader.aquireNextImage
, it tell me to close the reader.
If I do a reader.close
after, I got this:
BufferQueue has been abandoned
If you don't want to block your GUI for time-consuming operations you can run tasks in background. You can use AsyncTasks and Handlers (http://www.vogella.com/tutorials/AndroidBackgroundProcessing/article.html) or follow one of best practices for Android: https://developer.android.com/training/best-background.html