Join WhatsApp ChannelJoin Now

Disable screenshot in android

In this article, we will show you Disable screenshot in android. This article will give you simple example of Disable screenshot in android. you will learn Disable screenshot in android.

You just need to add this line in the activity

getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
   WindowManager.LayoutParams.FLAG_SECURE);

you can see this example

package com.codeplaners;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.WindowManager;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
				WindowManager.LayoutParams.FLAG_SECURE);

    }
}

Recommended Posts