Hi All, i'm trying to wrap a library and on one of the listeners for one of the properties i have the need to return an integer value, I was wondering if this is possible with any of the BA.RaiseEvent methods, if not is there any other way to accomplish this.
Below is the java portion of the code that i'm trying to accomplish this task.
As you can see the value returned is an Integer (color), but i would like to have the ability to customize the value returned, i would like to expose a method something like this:
And Basically pass the color value to the return value of the listener on the first code snippet above.
So the final Java code would probably look something like this:
Can this be done?
Thanks all,
Walter
Below is the java portion of the code that i'm trying to accomplish this task.
B4X:
series1.setValueDependentColor(new ValueDependentColor<DataPoint>() {
@Override
public int get(DataPoint data) {
BA.Log("data.getx(): " + data.getX() + " " + "data.getY(): " + data.getY());
return Color.rgb((int) data.getX()*255/4, (int) Math.abs(data.getY()*255/6), 100);
}
});
B4X:
Sub bar_SetColor(xdata as Double, ydata as Double) As Int
Return RGB(xdata*255/4, Abs(ydata*255/6, 100)
End Sub
And Basically pass the color value to the return value of the listener on the first code snippet above.
So the final Java code would probably look something like this:
B4X:
series1.setValueDependentColor(new ValueDependentColor<DataPoint>() {
@Override
public int get(DataPoint data) {
BA.Log("data.getx(): " + data.getX() + " " + "data.getY(): " + data.getY());
int color;
color = BA.RaiseEvent(null, EventName + "_setcolor", New Object[]{data.getX(), data.getY()});
return color;
}
})
Can this be done?
Thanks all,
Walter