I am currently learning code of one github project ScreenCapture, which can capture the screen and show the image in a surfaceview, here is the project <https://github.com/Charlesjean/android-ScreenCapture>. I tried to replace the surface of SurfaceView with surface of a ImageReader Object with the code below:  

```
 mImgReader = ImageReader.newInstance(mWidth, mHeight, ImageFormat.JPEG, 5);
    mSurface = mImgReader.getSurface();// mSurfaceView.getHolder().getSurface();
    mImgReader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() {
        @Override
        public void onImageAvailable(ImageReader reader) {
            Log.i(TAG, "in OnImageAvailable");

        }
    }, mHandler);

```

and create VirtualDisplay like this:  

```
mVirtualDisplay = mMediaProjection.createVirtualDisplay("ScreenCapture",
              mWidth, mHeight, mScreenDensity,
              DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY |
                      DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC,
              mSurface, new VirtualDisplay.Callback() {
                  @Override
                  public void onResumed() {
                      Log.i(TAG, "onResumed");
                      super.onResumed();
                  }

                  @Override
                  public void onPaused() {
                      Log.i(TAG, "onPaused");
                      super.onPaused();
                  }
              }, mHandler);

```

but the `onImageAvailable` method is never called, does anyone have any experience on this? I could not figure out why this does not work.