I wanted to programmatically turnoff screenshot and display snackbar as "screenshot is been disabled with this tab".
            Asked
            
        
        
            Active
            
        
            Viewed 2,188 times
        
    2
            
            
        - 
                    1Possible duplicate of [How to prevent Screen Capture in Android](https://stackoverflow.com/questions/28606689/how-to-prevent-screen-capture-in-android) – raj kavadia Mar 11 '19 at 19:24
- 
                    But it got just turning on with flags, need the snackbar or toast prompt – Mar 11 '19 at 19:31
- 
                    https://stackoverflow.com/questions/29532502/detect-a-screenshot-android – raj kavadia Mar 11 '19 at 21:04
1 Answers
2
            
            
        You can use this snippet in your activity to prevent screen capturing.
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
 
    
    
        Gursewak Dhindsa
        
- 79
- 3