Android Question Inline Java and AppCompat Compile error

Javier Alonso

Member
Licensed User
Longtime User
Hi, I have this bit of inline java to block screenshots:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    ' Block screenshots
#If Java
import android.annotation.TargetApi;
import android.content.Context;
import android.view.WindowManager.*;
Public void _onCreate() {
    this.getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE);
}
#End If
...
It used to work perfectly, but since I changed to AppCompat theme (I added the libs AppCompat and DesignSupport) it throws an error at compile time. Actually, I cannot use any inline java:

B4X:
B4A Version: 7.80
Parsing code.    (0.00s)
Compiling code.    (0.05s)
Compiling layouts code.    (0.01s)
Organizing libraries.    (2.46s)
Generating R file.    (1.66s)
Compiling debugger engine code.    (0.65s)
Compiling generated Java code.    Error
B4A line: 142
End Sub
javac 1.8.0_131
src\de\amberhome\appcompat\toolbarmenuexample\main.java:604: error: <identifier> expected
Public void _onCreate() {
      ^
1 error
Any ideas? Thank you in advance.
 
Top