Android Question Error when compiling B4A project with inline Java Code

Johan Schoeman

Expert
Licensed User
Longtime User
Cannot figure out why this keeps on generating an error when being compiled with B4A inline java code.

path.addArc((float) 0.0, (float) 0.0, (float) (targetWidth/2.0), (float) (targetHeight/2.0), (float) 180.0, (float) 100.0);


B4A version 4.30
Parsing code. 0.00
Compiling code. 0.06
Compiling layouts code. 0.00
Generating R file. 0.05
Compiling generated Java code. Error
javac 1.6.0_15
src\JHS\BubbleBitmap\main.java:579: addArc(android.graphics.RectF,float,float) in android.graphics.Path cannot be applied to (float,float,float,float,float,float)
path.addArc((float) 0.0, (float) 0.0, (float) (targetWidth/2.0), (float) (targetHeight/2.0), (float) 180.0, (float) 100.0);
^
1 error

targetWidth and targetHeight are declared as type int

It should use
android.graphics.Path
that I am already importing. The error above refers to
addArc(android.graphics.RectF,float,float)....??
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
nativeMe is a global variable not a process_global variable.
Still no joy when I changed it....same error as in previous post
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
'    Dim nativeMe As JavaObject
  
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
  
    Dim bm, bm1, bm2 As Bitmap
    Dim nativeMe As JavaObject

    Private ImageView1 As ImageView
    Private ImageView2 As ImageView

End Sub
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
from @Erel's example of inline java code:
B4X:
Sub Process_Globals
    Private nativeMe As JavaObject
End Sub
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Intersting, i would have thought it would get the applicationContext instead of activityContext.

anyway this is not easy to debug as the reflection exception is masking out the real exception that is happening behind it.

maybe add a try catch inside your java method and log the exception.
 
Upvote 0

Johan Schoeman

Expert
Licensed User
Longtime User
Not a train smash @thedesolatesoul. Have it just about working with pre-API21 by calling
addArc(RectF oval, float startAngle, float sweepAngle)....thanks for looking into it. Would just be great to understand what generates the error. Will try to catch it.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…