Pierre Hébert is there any possibility to pass an array as reference?
Pierre Hébert is there any possibility to pass an array as reference? I need to use View.getLocationOnScreen, but it requires a reference which I’m not able to create…
( developer.android.com/reference/android/view/View.html#getLocationOnScreen(int[]) )
]]>
< ![CDATA[
I’m interested on this topic too.
When I made my puzzle script I need to use a function with a reference array, and I didn’t know how to do that. Fortunately it was easy to make myself that function using another one without references.
Is View.getLeft() View.getTop() possible to use in your script?
]]>
< ![CDATA[
I have found a completely other solution, but I’d still like to know how to do it.
getTop() returns the relative position of a view to it’s parent. Unfortunately I can’t determine the position of the root view (the dialog) on the screen.
]]>
< ![CDATA[
Everything is reference, but javascript arrays are not java arrays and the engine cannot map one into the other one.
Try this:
var a = java.lang.reflect.Array.newInstance(java.lang.Integer, 5);
(where 5 is the array size)
Set elements using the common array accessor, i.e. a[0] = 3;
Then use this variable as argument to the function.
getLeft and getTop might not work, especially when transformation are in use. The best I can say is to avoid using them. Lightning has a very special way to handle the geometry.
Regarding the dialog, you also need to take into account the position of the window, because dialogs have their own window. But I am not sure of what you want to achieve, I think this is suspicious!
]]>
< ![CDATA[
Pierre Hébert I tried that, but it says can’t find function when I try to use the array with bitmap.getPixels
]]>
< ![CDATA[
My bad. Replace java.lang.Integer with java.lang.Integer.TYPE
]]>