-1

In generally while we use java , we use the below code

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

to disable screen recording. How can we do this in Kotlin ?

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
NJR
  • 37
  • 2
  • 8

2 Answers2

2

Use this for kotlin

window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)

and your need to import this import android.view.WindowManager

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
-2

yes .. I got the answer. just remove the semi colon at the end. ie, change

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

to

 getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
NJR
  • 37
  • 2
  • 8