Android Question I get a new error in 7.80 with this bit of inline Java code

NeoTechni

Well-Known Member
Licensed User
Longtime User
B4X:
#If JAVA
public boolean _onkeydown (int keyCode, android.view.KeyEvent event) {
   anywheresoftware.b4a.keywords.Common.CallSubNew3(mostCurrent.activityBA,main.getObject(),"Activity_KeyDown", keyCode, event.getSource());
   return true;
}
#End If

B4A Version: 7.80
Parsing code. (1.85s)
Compiling code. (1.16s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Generating R file. (0.06s)
Compiling generated Java code. Error
B4A line: 3651 (this is not the correct line number, btw. It's actually 1386)
End Sub
javac 1.8.0_45
src\com\omnicorp\scifiui\main.java:6270: error: unreported exception Exception; must be caught or declared to be thrown
anywheresoftware.b4a.keywords.Common.CallSubNew3(mostCurrent.activityBA,main.getObject(),"Activity_KeyDown", keyCode, event.getSource());

The point of the code is to give me access to the Source of a touch event, so I know if it's a stylus or a finger or a mouse.
 

barx

Well-Known Member
Licensed User
Longtime User
Try adding
B4X:
thows Exception

between the parenthses and opening curly brace
 
Upvote 0

NeoTechni

Well-Known Member
Licensed User
Longtime User
That seems to have done it, thank you.

B4X:
#If JAVA
public boolean _onkeydown (int keyCode, android.view.KeyEvent event) throws Exception {
   anywheresoftware.b4a.keywords.Common.CallSubNew3(mostCurrent.activityBA,main.getObject(),"Activity_KeyDown", keyCode, event.getSource());
   return true;
}
#End If
 
Upvote 0
Top