Refer to this I 've test the code about Block/Permit ScreenShot using B4XPage
My error is belows
my Code is belows
My error is belows
B4A Version: 13.40
Parsing code. (0.33s)
Java Version: 19
Building folders structure. (0.17s)
Running custom action. (0.22s)
Compiling code. (0.50s)
Compiling layouts code. (0.08s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Compiling resources (0.20s)
Linking resources (0.89s)
build tools: 36.0.0, android jar: android-36
Compiling generated Java code. Error
B4A line: 73
End Sub
src\b4a\example\b4xmainpage.java:114: error: cannot find symbol
this.getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
^
symbol: method getWindow()
1 error
only showing the first 1 errors, of 2 total; use -Xmaxerrs if you would like to see more
my Code is belows
B4X:
Private Sub B4XUISwitch1_Click
If B4XUISwitch1.SwitchState Then
Log(B4XUISwitch1.SwitchState)
'Allow screenshots
Dim wrk_jo As JavaObject=Me 'using B4XPage
'wrk_jo.InitializeContext
wrk_jo.RunMethod("unsecurescreen", Null)
Else
'Block screenshots
Dim wrk_jo As JavaObject=Me 'using B4XPage
'wrk_jo.InitializeContext
wrk_jo.RunMethod("securescreen", Null)
End If
End Sub
#If Java
import android.annotation.TargetApi;
import android.content.Context;
import android.view.WindowManager.*;
public void securescreen() {
this.getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
}
public void unsecurescreen() {
this.getWindow().clearFlags(LayoutParams.FLAG_SECURE);
}
#End If