I have a PreviewView instance on which i want to draw a rect based on object identifies using Firebase and Image Analyser use case.
However, unlike in Text/ SurfaceView PreviewView doesn't let any Canvas to be drawn on top of it.
What's the alternative?
Further Edits:
Tried the below earlier:
Canvas objectFrameCanvas = new Canvas();
Paint pen = new Paint();
pen.setColor(Color.RED);
pen.setStrokeWidth(8F);
pen.setStyle(Paint.Style.STROKE);
objectFrameCanvas.drawRect(100,150,200, 250, pen);
TextureView textureView = new TextureView(this);
textureView.draw(objectFrameCanvas);
mPreviewView.addView(textureView);
Create a child forviewgroup : textureView. Make new canvas objectFrameCanvas, draw rectangle on it, then draw canvas on textureView. Then add this to view group (PreviewView)
Still doesnt give me the requisite result it should.
By the way am using this inside my ImageAnanysis usecase
imageAnalysis.setAnalyzer(executor, new ImageAnalysis.Analyzer() {....}