0

Previously i used SurfaceView, which can be made transparent by the below method. I don't use SurfaceView now. Don't mark it as duplicate. I know how to make SurfaceView Transparent, Now i am trying to migrate my code from SurfaceView to GLSurfaceView . To make screen transparent , i tried the below method :

    public void clear() {
    Constants.debugLog(TAG,"clear method called ");
    Canvas canvas = null;
    try {
        canvas = getHolder().lockCanvas();
        canvas.drawColor(Color.TRANSPARENT);
    } catch (Exception e) {
        Constants.debugLog(TAG,"clear() 1st try  "+e.toString());
    } finally {
        try {
            if (canvas != null) {
                getHolder().unlockCanvasAndPost(canvas);
            }
        } catch (Exception e) {
            Constants.debugLog(TAG,"clear() 2nd try "+e.toString());
        }

    }
}

But it don't work on my custom GLSurfaceView. As GLSurfaceView is a subclass of SurfaceView, it should work on this. It throw the below exceptions

Exception locking surface
                                                                java.lang.IllegalArgumentException
                                                                    at android.view.Surface.nativeLockCanvas(Native Method)
                                                                    at android.view.Surface.lockCanvas(Surface.java:275)
                                                                    at android.view.SurfaceView$4.internalLockCanvas(SurfaceView.java:823)
                                                                    at android.view.SurfaceView$4.lockCanvas(SurfaceView.java:791)
                                                                    at com.ringid.voicecall.video.VideoCallImageRenderView.clear(VideoCallImageRenderView.java:77)
                                                                    at com.ringid.voicecall.OutgoingRingCallScreen.stopOwnVideoCall(OutgoingRingCallScreen.java:988)
                                                                    at com.ringid.voicecall.OutgoingRingCallScreen.decideStart_or_stop_Video(OutgoingRingCallScreen.java:1090)
                                                                    at com.ringid.voicecall.OutgoingRingCallScreen.onClick(OutgoingRingCallScreen.java:882)
                                                                    at android.view.View.performClick(View.java:4856)

Any idea about the problem will be helpful to me . Currently i am drawing image on GLSurfaceView from camera. When i stop camera and make the visibility of GLSurfaceView to GONE, it still show the last frame on screen. So i need to make that transparent

Md. Sulayman
  • 781
  • 8
  • 30
  • @Okas, I know how to make SurfaceView transparent, it's not that one. I previously used SurfaceView now migrating to GLSurfaceView, Don't think those two are same. and the method stated on the first block work fine for SurfaceView but create problem GLSurfaceView – Md. Sulayman Feb 26 '17 at 12:05
  • What about this one? http://stackoverflow.com/questions/17924502/how-to-make-the-glsurfaceview-transparent – Okas Feb 26 '17 at 12:18
  • Actually those things already work. I failed to describe the scenario. I am editing and adding more code – Md. Sulayman Feb 26 '17 at 12:39
  • I have two GLSurfaceView, one top of another. One render image from my camera, another one show image received from network. Let's my camera is off so the GLSurace view should not render anything. I close my camera, hide GLSurfaceView which is added in a FrameLayout. But the screen still show the last image which is rendered by GLSurfaceView. Thus i need to draw the last frame as Transparent so the still image which i rendered as last one don't show on screen. Can you understand the scenario – Md. Sulayman Feb 26 '17 at 12:44

0 Answers0